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 (
year. Nest is nested within
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?