6
$\begingroup$

I am new to Generalized additive mixed models (GAMM) and I'm trying to model a behavioral response variable (time spent shading eggs by a nesting bird in minutes timeCS) in relation to several predictor variables: maximum temperature (maxT), species (categorical), the day of the year (jdate) and the age of the nest (ca). My data was based on repeated observations at several nests of shorebirds.

I have three random effects: nest id (nest), location (rm) and year. Nest is nested within rm and year; while rm and year are crossed.

Since I have multiple random effects, I plan to use gamm4 in R as my software package to conduct the GAMM. So far I believe the correct code to run this analysis with my data is

 gamm4 <- (timeCS~s(maxT)+ species + s(jdate) + s(ca), 
           random=~(1|year)+(1|rm)+(1|rm:nest)+(1|year:nest), 
           data=Dataset, family=gaussian(link ="identity"))

Is this correct? Should I specify smooth terms for my predictor variables? Can I run model selection based on AICc on GAMM?

$\endgroup$
3
  • $\begingroup$ I have the same question - did you feel this was the correct model specification for your random effects? $\endgroup$
    – Kodiakflds
    Commented Apr 9, 2021 at 17:24
  • $\begingroup$ "Can I run model selection based on AICc on GAMM" in general, using the cross-validation error that AIC (sometimes) approximates would be better $\endgroup$
    – wzbillings
    Commented Mar 31, 2023 at 15:49
  • $\begingroup$ Were the same nests observed in different years, or was renesting in the same year observed? 1|year:nest seems like it night not be necessary - that might give a random intercept for each observation $\endgroup$
    – N Brouwer
    Commented Apr 20 at 22:28

1 Answer 1

0
$\begingroup$

Specifying random effect terms in gamm4 is different to mgcv. The syntax I show is provided in this book.

Two random effect terms in gamm4 is:

random = ~(1|xr1 + 1|xr2)

If they are nested, it is:

random = ~(1|xr1/xr2)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.