[R-sig-ME] GAMM (gamm4) warning: Hessian vs. RX var-cov

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Mon Jan 1 01:42:00 CET 2024


   These warnings should not affect the log-likelihood/AIC values in any 
case, they only refer to estimates of the covariance matrices of the 
fixed-effect parameters (which in this case will probably correspond to 
the non-penalized linear terms associated with most of the smooths).

  1. I'm not sure why use say "the smaller data sets" in this case: are 
you getting the warnings mostly with the models of smaller data sets? 
(You don't say that explicitly.)

2. I think it is probably OK to move forward with model selection and 
averaging.

The main thing to check is that the standard errors of the 
parameters/predictions seem reasonable.

   As a cross-check you could try fitting the same model with glmmTMB: I 
believe this model could also be fitted with the latest version of 
glmmTMB (although I would recommend using random effects of the form 
(1|boat_id) rather than s(boat_id, bs = 're') for the terms with bs = 're'

   A gold standard for the covariance estimates, if you're worried about 
this, is to run parametric bootstraps (or cluster-aware bootstraps as in 
the lmeresampler package), although I'm not sure how well these work 
with gamm4/uGamm models ...

On 2023-12-31 6:07 p.m., Meaghan Rupprecht wrote:
> Good afternoon and Happy New Year everyone~
> 
> I am running a series of models using various records of fish catch from different datasets. Datasets include a different number of records but are being modelled with the same general formula (the number of records in each dataset ranges from ~3,000 to ~20,000).
> 
> The general model formula is as follows:
> fit <-
>      uGamm(catch ~ s(effort, k = 30) + s(month, bs = 'cc', k = 12) + s(year, k = 15) + s(habitat, k = 15) + s(pop_dens, k = 15) + s(X,Y, bs= 'ts', k = 15) + s(saberes_boat_id, bs = 're') + s(landing_mun, bs = 're') + s(basin_id, bs = 're'),
>            family = Gamma(link = 'log'),
>            data = fish_catch,
>            control = glmerControl(optimizer = 'bobyqa',
>                                   optCtrl = list(maxfun = 2e5)),
>            lme4 = TRUE)
> 
> I am using the uGamm wrapper so that I can complete model averaging with the MuMIn package, but the models are being run with gamm4.
> 
> The resulting models of several datasets provide me with the following warning when I attempt model selection with MuMIn::model.sel():
> Warning messages:
> 1: In vcov(object, use.hessian = use.hessian) :
>    variance-covariance matrix computed from finite-difference Hessian is
> not positive definite or contains NA values: falling back to var-cov estimated from RX
> 2: In vcov.merMod(object, correlation = correlation, sigm = sig) :
>    variance-covariance matrix computed from finite-difference Hessian is
> not positive definite or contains NA values: falling back to var-cov estimated from RX
> 
> With the above information in mind, I have several questions.
> 
>    1.  Are the model results using the smaller datasets less reliable due to this warning?
>    2.  Can move forward with model selection and averaging with these errors present?
>    3.  If I can't move forward with model selection, how can I address these errors and get to the point where I can complete model selection and averaging?
> 
> Best,
> Meaghan
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list