jashu / beset

Best Subset Predictive Modeling
5 stars 0 forks source link

R - r2d function in beset package not providing any input #12

Closed gablaj closed 2 years ago

gablaj commented 2 years ago

I am trying to assess the fit of the following zero-inflated negative binomial model based on it's R2 value, using the r2d function of the beset package.

My model looks like this:

zero.infl.neg.bin.mod.reports.ac.year <- glmmTMB(Reports_per_week ~ (1|Park) + Reports_4w + Number_4w_AC + factor(Year), ziformula = ~ Reports_4w + Number_4w_AC + (1|Park), data = Reports_per_park_per_week_3, family = nbinom2, na.action = "na.fail")

I tried doing the following:

install.packages("remotes") remotes::install_github("jashu/beset") library(beset)

r2d(zero.infl.neg.bin.mod.reports.ac.year) This results in the following:

Fit R-squared:

As you can see, it doesn't actually provide any output. Does that mean that there is something wrong with my model, or with my code? Or is this function simply not compatible with models built using glmmTMB?

jashu commented 2 years ago

There is no r2d method for mixed effects models, sorry; it will only work for ZINB models fit with the pscl package. But it should throw an error rather than just printing a blank line, so thank you for pointing this out!

gablaj commented 2 years ago

That's great to know, thank you!