## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") set.seed(2026) ## ----------------------------------------------------------------------------- library(GLBFP) ## ----------------------------------------------------------------------------- n <- 250 group <- rbinom(n, size = 1, prob = 0.5) x <- cbind( rnorm(n, mean = ifelse(group == 1, -1.2, 1.2), sd = 0.7), rnorm(n, mean = ifelse(group == 1, 1.0, -1.0), sd = 0.8) ) colnames(x) <- c("x1", "x2") b <- compute_bi_optim(x, m = c(1, 1)) b ## ----------------------------------------------------------------------------- x0 <- c(0, 0) ash_fit <- ash(x0, x, b = b, m = c(1, 1)) lbfp_fit <- lbfp(x0, x, b = b) glbfp_fit <- glbfp(x0, x, b = b, m = c(1, 1)) c( ASH = ash_fit$estimation, LBFP = lbfp_fit$estimation, GLBFP = glbfp_fit$estimation ) ## ----------------------------------------------------------------------------- grid_fit <- glbfp_estimate(x, b = b, m = c(1, 1), grid_size = 20) summary(grid_fit) head(as.data.frame(grid_fit)) ## ----------------------------------------------------------------------------- plot(grid_fit, contour = TRUE) ## ----eval = FALSE------------------------------------------------------------- # surface <- plot(grid_fit, contour = FALSE) # surface