## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
set.seed(20260607)

## -----------------------------------------------------------------------------
library(GLBFP)

x <- matrix(rnorm(200), ncol = 1)
b <- compute_bi_optim(x, m = 1)

point_fit <- glbfp(0, x, b = b, m = 1)
class(point_fit)
summary(point_fit)
predict(point_fit)

## -----------------------------------------------------------------------------
grid_fit <- glbfp_estimate(x, b = b, m = 1, grid_size = 60)

class(grid_fit)
summary(grid_fit)

grid_df <- as.data.frame(grid_fit)
head(grid_df)

## -----------------------------------------------------------------------------
new_points <- matrix(c(-1, 0, 1), ncol = 1)
predict(grid_fit, newdata = new_points)

## -----------------------------------------------------------------------------
plot(grid_fit)

## -----------------------------------------------------------------------------
x2 <- cbind(rnorm(120), rnorm(120))
grid_2d <- glbfp_estimate(x2, b = c(0.8, 0.8), m = c(1, 1), grid_size = 12)

plot(grid_2d, contour = TRUE)

