Legacy estimation example

This vignette is kept for backward compatibility with the original package article structure. New users should start with “Getting started with GLBFP”, then read “Package overview and workflow map”.

library(GLBFP)
data("ashua")

river_data <- ashua[, c("flow", "level")]
x0 <- c(mean(river_data$flow), mean(river_data$level))
b <- c(8, 0.4)

fit <- GLBFP(x0, river_data, b = b, m = c(1, 1))
fit
#> GLBFP Density Estimation:
#> Point: (249.0230, 30.4197) 
#> Estimated density: 0.00377442 
#> Estimated standard error: 0.000316735 
#> 95% confidence interval: 0.00376918, 0.00377966 
#> Bandwidths (b): 8.0, 0.4 
#> Shifts (m): 1, 1 
#> Relative grid coordinate (u): 0.690325, 0.224216

grid_fit <- GLBFP_estimate(
  river_data,
  b = b,
  m = c(1, 1),
  grid_size = 12
)

head(as.data.frame(grid_fit))
#>    flow level     density           sd    IC_lower    IC_upper visited
#> 1  39.5 29.33 0.001085811 0.0006951193 0.001074315 0.001097307       4
#> 2 175.0 29.33 0.000000000 0.0000000000 0.000000000 0.000000000       2
#> 3 310.5 29.33 0.000000000 0.0000000000 0.000000000 0.000000000       0
#> 4 446.0 29.33 0.000000000 0.0000000000 0.000000000 0.000000000       0
#> 5 581.5 29.33 0.000000000 0.0000000000 0.000000000 0.000000000       0
#> 6 717.0 29.33 0.000000000 0.0000000000 0.000000000 0.000000000       0
#>   prefix_nodes
#> 1            6
#> 2            6
#> 3            6
#> 4            6
#> 5            6
#> 6            6