[R-sig-ME] random slopes in gamm4
John Morrongiello
john.morrongiello at unimelb.edu.au
Wed Sep 2 01:10:08 CEST 2015
Hi all
Most GAMM examples involve the fitting of a model with just a random intercept (e.g. M1 below). However, I'd like to explore the possibility of each individual (ID) having a different X1 smoother 'slope', akin to a random slope in lmer (M2)
M1<-gamm4(response ~ s(X1,k=4), random =~(1|ID),data)
M2<-gamm4(response ~ s(X1,k=4), random =~(X1|ID),data)
However, I'm unsure how to interpret the random slope X1 in M2. If positive, is it an overall increase in smoother 'wriggliness' i.e. increase in edf (opposite for negative)? Or is it something else? Would someone know how to visualise these 'random smoothers' so I can get a feel for what is going on?
I found an example using the amer package (http://www.statistik.lmu.de/~poessnecker/Lehre/SoSe2011/SchaetzentestenII/material/hohenriedAmer.pdf) that does what I'd like to do (and plots up random smoothers), but I have no familiarity with this package and it appears to have been removed from cran.
d2 <- amer(y ~ -1 + group + bsp(time, k = 6, by = group) + bsp(time, k = 6, by = dog, allPen = T), data = dog), corr = F
The amer notes also say that gamm4 can't do subject-wise smooth trends, so I guess it is not possible? Which brings me back to my first question- what is the (X1|ID) in M2 doing?
Cheers
John
--
Dr. John R. Morrongiello
School of BioSciences
University of Melbourne
Victoria 3010, Australia
T: +61 3 8344 8929
M: +61 403 338 554
E: john.morrongiello at unimelb.edu.au<mailto:%20jmorrongiell at unimelb.edu.au>
W: morrongiellolab.com<http://morrongiellolab.com/>
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list