-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Hello,
parameters::bootstrap_model() fails when the model has only the intercept.
library(reprex)
y<-1:10
mod<-lm(y~1)
parameters::bootstrap_model(mod)
#> Error in model.frame.default(formula = y ~ 1, data = d, drop.unused.levels = TRUE): 'data' must be a data.frame, environment, or listCreated on 2025-07-07 with reprex v2.1.1
By inspecting the code, it seems that the issue arises in the bootstrap function in bootstrap_model.default()
boot_function <- function(model, data, indices) {
d <- data[indices, ]
.....
If modified like this
boot_function <- function(model, data, indices) {
d <- data[indices, , drop=FALSE]
.....
the whole bootstrapping works also for intercept-only models
Metadata
Metadata
Assignees
Labels
No labels