Mixing it up with random effects Joshua Loftus Mixed models Intro - - PowerPoint PPT Presentation

mixing it up with random effects
SMART_READER_LITE
LIVE PREVIEW

Mixing it up with random effects Joshua Loftus Mixed models Intro - - PowerPoint PPT Presentation

Mixed models Mixing it up with random effects Joshua Loftus Mixed models Intro to mixed models What is a mixed model? For simplicity well only talk about linear models. Mixed GLS y = X + Zb + , Cov( y ) = , b , and are all


slide-1
SLIDE 1

Mixed models

Mixing it up with random effects

Joshua Loftus

slide-2
SLIDE 2

Mixed models Intro to mixed models

What is a mixed model?

For simplicity we’ll only talk about linear models. Mixed GLS y = Xβ + Zb + ǫ, Cov(y) = Σ β, b, and ǫ are all unobserved β is a vector of parameters b is a vector of random variables ǫ error with E(ǫ) = 0, Cov(b, ǫ) = 0 Inference about (β, Σ) from conditional distribution y|b

slide-3
SLIDE 3

Mixed models Intro to mixed models

Examples

Mixed GLS y = Xβ + Zb + ǫ, Cov(y) = Σ “Random slopes and intercepts” Error is not i.i.d. / Clustered errors Test scores of students, school effect, teacher effect Assume b ∼ N(0, σ2

TI). What if σ2 T is large? Small?

What if there are only a handful of teachers in the study? Repeated measures / Longitudinal, e.g. gene ∼ drug * time

slide-4
SLIDE 4

Mixed models Intro to mixed models

Fitting the model

If Var(b) = D and Var(ǫ) = R then Var(y) = R + ZDZT R, D, and maybe even Z are functions of another parameter θ (“variance components”) Often reasonable to assume multivariate normality of y|b Maximum likelihood estimation of θ based on L(θ, β; y) does not account for loss in degrees of freedom caused by estimating β. Analogous to ˆ σ/n vs. ˆ σ/(n − p) REML based on “residual” of y (residual contrasts) REML coincides with ANOVA for balanced designs

slide-5
SLIDE 5

Mixed models Intro to mixed models

Fitting mixed models in R with lme4

Examples using the lme4 package in R pitch ∼ gender + (1|subject) + (1|scenario) price ∼ time + (time|product) participation ∼ extroversion + (1|school/class) Read more (these links were also in the email I sent earlier) http://cran.r-project.org/web/packages/lme4/ vignettes/lmer.pdf http://cran.r-project.org/web/packages/lme4/lme4.pdf

slide-6
SLIDE 6

Mixed models Intro to mixed models

Formulas in lme4

slide-7
SLIDE 7

Mixed models Intro to mixed models

Discussion

Questions? More examples: fixed effects vs. random effects Next topic? Time series Bootstrap Multiple comparisons + selective inference Causal inference Missingness / data cleaning / etc Bonus session on basic stats?