[R] Random effect in GAM (mgcv)

Bert Gunter bgunter.4567 at gmail.com
Sun Mar 4 16:37:18 CET 2018


Statistics questions are largely off  topic on this list, although they do
sometimes intersect R programming issues, which are on topic. However, I
believe a statistics list like stats.stackexchange.com might be more
suitable for your query.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sun, Mar 4, 2018 at 4:10 AM, Vaniscotte Amélie <vanamelie at gmail.com>
wrote:

> Dear R users,
>
>
> I am using the *mgcv package* to model the ratio of hectares of damaged
> culture by wild boar in french departments according to some
> environmental covariates. I used a _Beta distribution_ for the response.
>
>
> For each department, we estimated the damaged in 3 different culture
> types (« Culture »). Our statistical individual are therefore the
> department crossed by the culture type.
>
> Also, the department are clustered into landscape types (« Cluster »).
>
> Since I want to get the effect of the Culture type and the Landscape, I
> keep those variables as fixed effects in the model.
>
>
> Also, since we have 5 repetitions of the response and of some covariates
> measurement in time per department and culture type, I put a random
> effect on the Department per Culture type and the Year as fixed effect
> as well.
>
>
> The model takes the form :
>
>
> *gam_tot <- gam (resp ~ Culture + Clust**er**:Culture + s(**Year**,k=4,
> by=Culture) + s(**X1**, by=Culture) + s(**X2**, by=Culture) + s(Depts,
> bs="re", by=Culture) *
>
> *, family=betar(link="logit"),method="REML",data=data,select=FALSE)*
>
>
> Then, I estimated the part of the model explained deviance provided by
> each covariate. For that, I run the model without the given covariate
> (keeping smooth parameters constant between models), and compute the
> difference in deviance between the Full model (with the given covariate)
> and the penalized model (without the given covariate):
>
> (Full model Deviance – Penalized model Deviance) / Full Model Deviance
>
>
>  From that, I get a _huge proportion of Deviance explained by the random
> effect_ (Department) of about 30 %, while the others covariates
> explained less than 1 %.
>
>
>
> *At this point, I have few questions :*
>
>
> *- Do you think my model formula is correct regarding my data and
> questions ?*
>
>
> *- Is my estimate of explained deviance correct ?*
>
> *In that case, how can I explain such a huge discrepancy between **the
> part of deviance explained by **random and fixed effects ? *
>
>
> Thanks for your help,
>
>
>
> Amélie
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list