Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projpred::cv_varsel() returning “Not enough (non-NA) data to do anything meaningful” error #239

Open
tzuffa opened this issue Nov 4, 2021 · 1 comment
Labels
additive Issues concerning additive models (GAMs and GAMMs).

Comments

@tzuffa
Copy link

tzuffa commented Nov 4, 2021

Hello,

When attempting to perform projection predictive variable selection (projpred::cv_varsel()) on a model that includes both an s() spline term(s) and a random effect(s) I get the following message:
variable_selection <- cv_varsel(ref_model)
[1] “Computing LOOs…”
|| 0%
Error in model.matrix.gamm4(delete.response(terms(formula)), random = random, :
Not enough (non-NA) data to do anything meaningful

I have tried installing the latest development version of the projpred package from GitHub to resolve the issue, but the problem persists. I have also tried to rerun the model and variable selection on a Linux-based server with R (4.1.0) and RStudio Server to test whether the problem is not specific to my local Mac/system, but the process stopped with the same error.

I am attaching two small datasets (one with a Gaussian and the other with a binary response) and two reproducible examples that give the error.

#gaussian_data <- read.csv("~/ ..... /gaussian_data.csv") # define pathway

fit1 <- brm(y ~ s(x) + (1|group)
,data = gaussian_data
,cores = 4
,backend = "cmdstanr"
,control = list(
adapt_delta = 0.99
,max_treedepth = 15)
,seed = 123)
ref_fit1 <- get_refmodel(fit1)
variable_selection_fit1 <- cv_varsel(ref_fit1)

#binary_data <- read.csv("~/ ..... /binary_data.csv") # define pathway

fit2 <- brm(y ~ s(x) + (1|group)
,data = binary_data
,family = bernoulli(link = "logit")
,cores = 4
,backend = "cmdstanr"
,control = list(
adapt_delta = 0.99
,max_treedepth = 15)
,seed = 123)
ref_fit2 <- get_refmodel(fit2)
variable_selection_fit2 <- cv_varsel(ref_fit2)

Many thanks for looking at this.

Best wishes,

Tom

gaussian_data.csv
binary_data.csv

@fweber144 fweber144 added the additive Issues concerning additive models (GAMs and GAMMs). label Apr 4, 2022
@fweber144
Copy link
Collaborator

@AlejandroCatalina: Since you are the expert for additive models, could you take a look at this? I guess this hasn't been resolved yet in the most recent CRAN release.

fweber144 added a commit to fweber144/projpred that referenced this issue Apr 20, 2022
fweber144 added a commit that referenced this issue Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
additive Issues concerning additive models (GAMs and GAMMs).
Projects
None yet
Development

No branches or pull requests

2 participants