Does projpred not work for models with splines?

brms version 2.15.0
projpred version 2.0.2
I am trying to use projpred on my below model run in brms. However, when I run either get_refmodel() or varsel() I get an error.

m18 <- brm(outcome|rate(admissions) ~ 1 + time*treatment + var1 + var2 + s(month, k=12, bs="cc"), 
	data=data1, family=negbinomial, control = list(adapt_delta = 0.9999, max_treedepth=15))

vs <- varsel(m18)

I get the error message: “Error: Projpred only supports standard multilevel terms and offsets.”

Does projpred not work with models that include splines?


Edit: I tried the same model without the spline and I get this error when calling varsel():
“Error in get(extend_family_specific, mode = “function”) :
object ‘extend_family_negbinomial’ of mode ‘function’ was not found”

1 Like

@AlejandroCatalina any ideas what this error is about? Thanks!

For the second error, maybe negative binomial is not implemented yet: Implement negative binomial · Issue #67 · stan-dev/projpred · GitHub

For the first error, regarding multilevel terms and offsets, still not sure.

I believe the problem is the parsing of the smooth term! You can fit the simplified s(month) for now while we fix the parsing.

Thanks for the response! Unfortunately, I get the same error with s(month). It only seems to work if I remove the spline from the model. (and of course change the family to Poisson, as nb is not supported)

I can test it locally if you send me the brmsfit object. It should work with s(month) as far as I know!

I can’t share the data, so I made some simple simulation and ran a similar poisson model with s(time). I get the same error. It doesn’t look like I can upload my brmsfit object to Stan forum, so I am attaching the code to replicate here.sim poisson spline varsel error.txt (826 Bytes)

Great, a simple simulation will do! I’ll get back to you.


Interesting! The problem appears to be on brms’ end, @paul.buerkner. It seems get_refmodel.brmsfit thinks s terms are not allowed.

This should already be fixed in the latest dev version of brms.



That works. Thanks!
Thanks @AlejandroCatalina for looking into this.