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

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

x <- cbind(rnorm(200), rnorm(200, sd = 1.25))
b <- c(0.75, 0.9)
m <- c(2, 2)
point <- c(0, 0)

fits <- list(
  ASH = ash(point, x, b = b, m = m),
  LBFP = lbfp(point, x, b = b),
  GLBFP = glbfp(point, x, b = b, m = m)
)

vapply(fits, function(z) z$estimation, numeric(1))

## -----------------------------------------------------------------------------
grid_ash <- ash_estimate(x, b = b, m = m, grid_size = 15)
grid_lbfp <- lbfp_estimate(x, b = b, grid_size = 15)
grid_glbfp <- glbfp_estimate(x, b = b, m = m, grid_size = 15)

comparison <- data.frame(
  method = c("ASH", "LBFP", "GLBFP"),
  mean_density = c(
    mean(grid_ash$densities),
    mean(grid_lbfp$densities),
    mean(grid_glbfp$densities)
  ),
  max_density = c(
    max(grid_ash$densities),
    max(grid_lbfp$densities),
    max(grid_glbfp$densities)
  )
)

comparison

