Missing parameters from model fits when using beta family
bmcnellis opened this issue · 0 comments
bmcnellis commented
I'm trying to fit a beta-family gllvm to analyze some plant cover data. I get the following error:
Error in t.default(cbind(fit.mva$params$beta0, fit.mva$params$Xcoef)) :
argument is not a matrix
In addition: Warning messages:
1: In nlminb(objr$par, objr$fn, objr$gr, control = list(rel.tol = reltol, :
NA/NaN function evaluation
2: In gllvm.TMB(y = y, family = family, num.lv = 0, starting.val = "zero", :
Error in nlminb(objr$par, objr$fn, objr$gr, control = list(rel.tol = reltol, :
NA/NaN gradient evaluation
I traced the error back to a matrix operation that is failing because the params
entry within fit.mva
doesn't exist - its not clear to me if this is a model specification issue or other code issue. Is there some other function input that is required for beta models? Or another vignette using them specifically? Thanks in advance!
Reproducible example:
devtools::install_github("admahood/neonPlantEcology")
data_div <- neonPlantEcology::npe_download(sites = "WREF")
data_df <- neonPlantEcology::npe_longform(data_div, scale = 'plot')
gllvm::gllvm(formula = cover ~ 1, data = data_df, family = "beta", num.lv = 2L, link = 'logit')
EDIT: the example data works if specified differently, and if adjusted to the 0-1 scale:
devtools::install_github("admahood/neonPlantEcology")
data_div <- neonPlantEcology::npe_download(sites = "WREF")
data_df <- neonPlantEcology::npe_longform(data_div, scale = 'plot')
data_mat <- neonPlantEcology::npe_community_matrix(data_div)
gllvm::gllvm(y = data_mat, family = "beta", num.lv = 2L, link = 'logit', starting.val = 'zero')
The error was quite cryptic before - perhaps something else would do better?