Hi Mari,

I'm currently working on the same question - but I haven't found an answer
yet. But one thing I'm wondering:

Why do you compare the null variance of a GAM with the residual deviance of
a GAMM? For me, it makes more sense to compare the null deviance of a null
GAMM (model without predictors) with the full GAMM.

>From my understanding, the author of the thesis you refer to used the
deviance to choose the best model, i.e. whether a GAM or a GAMM fits better
the model. In this case, it makes sense to compare the GAM with the GAMM.

Hope someone else can share some light on this!

Best, Julia



2013/12/3 Mari Lyly <mari.s.lyly@utu.fi>

> Hello all,
>
> I'm using GAMM (mgcv::gamm) to fit non-Gaussian models with several fixed
> factors and smooth terms, and also a temporal structure. I have correlated
> main effect candidates, and I would like to compare their GAMMs to see,
> which one of the models best fits the data. The random structure is the
> same in all of the models.
>
> I came across a thesis on Additive Mixed Models (
> http://eio.usc.es/pub/mte/descargas/ProyectosFinMaster/Proyecto_393.pdf).
> Following that example, I plan to use the proportion of deviance explained
> as a tool for model comparison and tuning the models in GAMM. The DE% is
> defined as:
> (null deviance - residual deviance ) / null deviance
>
> I have tried using the following script, but I end up having residual
> deviance (DR) slightly larger than the null deviance (DN):
> DN <- deviance(gam(model0 ~ 1, data=data, family=poisson))
> model1 <-gamm(response ~ s(cov1, by=factor1) + s(cov2) + s(cov3) + s(cov4)
> + cov5,
>      random=list(factor2= ~ 1), correlation= corAR1(form= ~ factor3 |
> factor2), data=data, family=poisson)
> DR <- sum(residuals(model1$gam, type="pearson")^2)
>
> Would someone be able to tell if I am using the correct code to extract DN
> from the null model (GAM) and DR from the model to be compared (GAMM)? To
> my understanding, DR values should be clearly smaller than DN (unless it's
> overparameterization, which should not be the case here). If I'm not using
> the right functions, then please give advice on how to acquire the correct
> values.
>
> With best regards,
>    Mari Lyly
> __________________________________
> Mari Lyly, PhD student
> University of Turku
> e-mail: mari.s.lyly@utu.fi
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]

