[R-sig-ME] Random effect in GAM
Vaniscotte Amélie
vanamelie at gmail.com
Sun Mar 4 18:54:43 CET 2018
Dear R users,
I am using the mgcv package in R to model the ratio of damaged culture
hectares by wild boar in each french department according to some
environmental covariates(cf data attached). I used a using a Beta
distribution for the response.
For each department, the damages are estimated in 3 different culture
types (« Culture »). Also, the department are clustered into landscape
types (« Cluster »). Since I wanted 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 in time of the response and of some
covariates measurement per department and culture type, I put a random
effect on the Department per Culture type and put the year as fixed
effect as well.
The model takes the form :
gam_tot <-gam(resp ~ Culture + Cluster: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 discrepancy between the part of explained deviance
by random and fixed effects ?
Thanks for your help,
Amélie
More information about the R-sig-mixed-models
mailing list