[R] Random slopes in lmer
Darin A. England
england at cs.umn.edu
Thu Aug 26 18:45:26 CEST 2010
I'm sure this has appeared before on this list, but the biggest
help to me has been: "Gelman and Hill", Data Analysis and
Regression Using Multilevel/Hierarchical Models, which contains
clear explanations and the R code to go along. Also check out
http://lme4.r-forge.r-project.org/book/
Looking at Sam's model specification, C is a fixed effect.
On Thu, Aug 26, 2010 at 09:15:14AM -0700, Bert Gunter wrote:
> ???
> You were provided exactly what you requested. I think you either need
> to read up on what random effects models mean or more clearly
> communicate what YOU mean. (It's unclear to me, anyway).
>
> --
> Bert Gunter
> Genentech Nonclinical Statistics
>
> On Thu, Aug 26, 2010 at 8:57 AM, Samantha Patrick
> <samantha.patrick at plymouth.ac.uk> wrote:
> > Hi
> > Thanks for your help - however if I have a model of:
> >
> > mod1<-lmer(B~ A+C+(A|bird), family=quasibinomial)
> >
> > coef then gives me an individual slope for factors A and C. ?However the random effect is only nested within factor - so I am only trying to allow the slope to vary in relation to effect A
> >
> > Many Thanks
> >
> > Sam
> >
> > Dr Samantha Patrick
> > EU INTERREG Post Doc
> > Davy 618
> > Marine Biology & Ecology Research Centre
> > University of Plymouth
> > Plymouth
> > PL4 8AA
> >
> > T: 01752 586165
> > M: 07740472719
> >
> >
> > -----Original Message-----
> > From: Darin A. England [mailto:england at cs.umn.edu]
> > Sent: 26 August 2010 16:12
> > To: Samantha Patrick
> > Cc: r-help at R-project.org
> > Subject: Re: [R] Random slopes in lmer
> >
> > coef(mod1)$bird will give you a matrix with two columns. The first
> > column is the intercept for each bird and the second column is the
> > slope for each bird.
> >
> > ranef(mod1) will also give you a matrix of two columns. These
> > represent the random effects. That is, how much the intercept (or
> > slope) is shifted from overall mean.
> >
> > HTH,
> > Darin
> >
> > On Thu, Aug 26, 2010 at 01:15:10PM +0100, Samantha Patrick wrote:
> >> Hi
> >>
> >> I want to extract the random slopes from a lmer (I am doing a random regression), but are the answers obtained from ranef or coef?
> >>
> >> My model is: mod1<-lmer(B~ A +(A|bird), family=quasibinomial)
> >>
> >> And I want to obtain a slope for each individual bird but am not sure which output I need and can't find the answer anywhere.
> >>
> >> Thanks
> >>
> >> Sam
> >>
> >>
> >> Dr Samantha Patrick
> >> EU INTERREG Post Doc
> >> Davy 618
> >> Marine Biology & Ecology Research Centre
> >> University of Plymouth
> >> Plymouth
> >> PL4 8AA
> >>
> >> T: 01752 586165
> >> M: 07740472719
> >>
> >>
> >> ? ? ? [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> 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.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > 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.
More information about the R-help
mailing list