Mixed Effects Models Rebecca Atkins and Rachel Smith March 30, 2015.

Slides:



Advertisements
Similar presentations
Simple linear models Straight line is simplest case, but key is that parameters appear linearly in the model Needs estimates of the model parameters (slope.
Advertisements

Kin 304 Regression Linear Regression Least Sum of Squares
6-1 Introduction To Empirical Models 6-1 Introduction To Empirical Models.
Regression Analysis Simple Regression. y = mx + b y = a + bx.
Linear regression models
Lecture 6 (chapter 5) Revised on 2/22/2008. Parametric Models for Covariance Structure We consider the General Linear Model for correlated data, but assume.
Objectives (BPS chapter 24)
CJT 765: Structural Equation Modeling Class 3: Data Screening: Fixing Distributional Problems, Missing Data, Measurement.
Biostatistics-Lecture 10 Linear Mixed Model Ruibin Xi Peking University School of Mathematical Sciences.
LINEAR REGRESSION: Evaluating Regression Models Overview Assumptions for Linear Regression Evaluating a Regression Model.
LINEAR REGRESSION: Evaluating Regression Models. Overview Assumptions for Linear Regression Evaluating a Regression Model.
Chapter 10 Simple Regression.
Regression Hal Varian 10 April What is regression? History Curve fitting v statistics Correlation and causation Statistical models Gauss-Markov.
Mixed models Various types of models and their relation
Statistical Analysis SC504/HS927 Spring Term 2008 Session 7: Week 23: 7 th March 2008 Complex independent variables and regression diagnostics.
Topics: Regression Simple Linear Regression: one dependent variable and one independent variable Multiple Regression: one dependent variable and two or.
Linear and generalised linear models
Regression Diagnostics Checking Assumptions and Data.
Quantitative Business Analysis for Decision Making Simple Linear Regression.
Regression Model Building Setting: Possibly a large set of predictor variables (including interactions). Goal: Fit a parsimonious model that explains variation.
Introduction to Regression Analysis, Chapter 13,
Conditions of applications. Key concepts Testing conditions of applications in complex study design Residuals Tests of normality Residuals plots – Residuals.
Correlation & Regression
Introduction to Multilevel Modeling Using SPSS
Regression and Correlation Methods Judy Zhong Ph.D.
Fixed vs. Random Effects Fixed effect –we are interested in the effects of the treatments (or blocks) per se –if the experiment were repeated, the levels.
ALISON BOWLING THE GENERAL LINEAR MODEL. ALTERNATIVE EXPRESSION OF THE MODEL.
Research Methods I Lecture 10: Regression Analysis on SPSS.
Repeated Measurements Analysis. Repeated Measures Analysis of Variance Situations in which biologists would make repeated measurements on same individual.
MBP1010H – Lecture 4: March 26, Multiple regression 2.Survival analysis Reading: Introduction to the Practice of Statistics: Chapters 2, 10 and 11.
Inference for Regression Simple Linear Regression IPS Chapter 10.1 © 2009 W.H. Freeman and Company.
Regression Analysis Week 8 DIAGNOSTIC AND REMEDIAL MEASURES Residuals The main purpose examining residuals Diagnostic for Residuals Test involving residuals.
Review of Building Multiple Regression Models Generalization of univariate linear regression models. One unit of data with a value of dependent variable.
Multiple Regression Petter Mostad Review: Simple linear regression We define a model where are independent (normally distributed) with equal.
1 Multiple Regression A single numerical response variable, Y. Multiple numerical explanatory variables, X 1, X 2,…, X k.
Tutorial 4 MBP 1010 Kevin Brown. Correlation Review Pearson’s correlation coefficient – Varies between – 1 (perfect negative linear correlation) and 1.
REGRESSION DIAGNOSTICS Fall 2013 Dec 12/13. WHY REGRESSION DIAGNOSTICS? The validity of a regression model is based on a set of assumptions. Violation.
Ch14: Linear Least Squares 14.1: INTRO: Fitting a pth-order polynomial will require finding (p+1) coefficients from the data. Thus, a straight line (p=1)
Statistics……revisited
Statistics 3: mixed effect models Install R library lme4 to your computer: 1.R -> Packages -> Install packages 2.Choose mirror 3.Choose lme4 4.Open the.
Problem What if we want to model: –Changes in a group over time Group by time slices (month, year) –Herd behavior of multiple species in the same area.
Introduction to Multilevel Analysis Presented by Vijay Pillai.
G Lecture 71 Revisiting Hierarchical Mixed Models A General Version of the Model Variance/Covariances of Two Kinds of Random Effects Parameter Estimation.
Tutorial 5 Thursday February 14 MBP 1010 Kevin Brown.
Lab 4 Multiple Linear Regression. Meaning  An extension of simple linear regression  It models the mean of a response variable as a linear function.
Lecturer: Ing. Martina Hanová, PhD.. Regression analysis Regression analysis is a tool for analyzing relationships between financial variables:  Identify.
The “Big Picture” (from Heath 1995). Simple Linear Regression.
Linear model. a type of regression analyses statistical method – both the response variable (Y) and the explanatory variable (X) are continuous variables.
Longitudinal Data & Mixed Effects Models Danielle J. Harvey UC Davis.
AP Statistics Chapter 14 Section 1.
B&A ; and REGRESSION - ANCOVA B&A ; and
Generalized Linear Models
Kin 304 Regression Linear Regression Least Sum of Squares
Linear Mixed Models in JMP Pro
Mixed models and their uses in meta-analysis
Chapter 12: Regression Diagnostics
Correct statistics in ecological research
Stats Club Marnie Brennan
G Lecture 6 Multilevel Notation; Level 1 and Level 2 Equations
Model Diagnostics and OLS Assumptions
CHAPTER 29: Multiple Regression*
Multiple Regression A curvilinear relationship between one variable and the values of two or more other independent variables. Y = intercept + (slope1.
Simple Linear Regression
Adequacy of Linear Regression Models
Adequacy of Linear Regression Models
Checking the data and assumptions before the final analysis.
A protocol for data exploration to avoid common statistical problems
Adequacy of Linear Regression Models
Inference for Regression
Andrea Friese, Silvia Artuso, Danai Laina
Presentation transcript:

Mixed Effects Models Rebecca Atkins and Rachel Smith March 30, 2015

Up to now… General Linear Model (lm) – y i = α + β β + ε with ε ~ N(0, σ i 2 ) Generalized Linear Model (glm) – Non-normal error distributions for response variable; link function Generalized Additive Model (gam) – Identify smoothed lines of best fit for non-linear relationships Generalized Least Squares (gls) – Altered variance structures of Normal distribution

Residuals are normally distributed Histogram or Q-Q plot Residuals are “homogenous” or “homoscedastic” (constant variance) – No autocorrelation between observations plot residuals No colinearity between independent variables Pairs plot in R The model is not biased by unduly influential observations “Cook’s Distance” and leverage Independent observations

Nested data? Blocking? Repeated measures? Split-plot designs? Spatial or temporal autocorrelation? But what about…

Use of mixed models “Mixed effects models or multilevel models and are used when the data have a hierarchical form…which can have both fixed and random coefficients together with multiple error terms.” 1 Zuur et al Analyzing Ecological Data. Pg 127

Rob Thomas

GLS LM, GAM, GLM Model Structure LMM, GLMM, GAMM

Parameter estimation ML = Maximum Likelihood – Common with GLM REML = Restricted Maximum Likelihood – Corrects ML estimation for the number of fixed covariates – Less influenced by outliers than ML estimates – Common with LMM

R packages library(nlme) = Non-Linear Mixed Effects –lme = Linear Mixed Effects –gls = Generalised Least Squares –model<- lme (y ~ fixed, random = ~1|random, data) library ( lme4) = Linear Mixed Effects v.4 –lmer = Linear Mixed Effects REML –model <- lmer(y ~ fixed + (1|random), family = gaussian (link = “identity”), data)

Nested Design Example Are there any differences between the NAP- richness relationship at these 9 beaches? – NAP = tidal height, predictive variable – Species richness = response variable From Zuur 2009

richness values for beach i, i = 1,…,9 Fixed Term Richness-NAP fixed effect across all beaches Random Term Richness-NAP random effect for each beach Mixed Effects Model Structure From Zuur 2009

Model 1: Constant slope/intercept y i = α + β i + ε with ε ~ N(0, σ i 2 ) Assumes that the richness-NAP relationship is the same at all beaches model1 <- gls (richness ~ 1 + NAP, method = “REML”, data ) From Zuur 2007 and Rob Thomas A model fitted using the REML method, but containing no random effects at all–basically a REML-fitted linear regression

i.e. a model that fits the same slope for each level of the random factor (fitted by REML by default) Model 2: varying intercept, same slope y ij = α+ β ij + a j + ε j where a j ~ N(0, σ a 2 ) and ε j ~ N(0, σ 2 ) model2 <- lme (richness ~ NAP, random = ~1|beach, method = “REML”, data) From Zuur 2007 and Rob Thomas

Model 3: varying slope, varying intercept y ij = α + β ij + a j + b j x ij + ε j where a j ~ N(0, σ a 2 ), b j ~ N(0, σ b 2 ), and ε j ~ N(0, σ 2 ) model3 <-- lme (richness ~ NAP, random = ~NAP | beach, method = “REML”, data) i.e. a model that fits a different slope for each level of the random factor (fitted by REML by default) From Zuur 2007 and Rob Thomas

Additional complexity Generalized Mixed models: lmer() and mgcv() GLMM and GAMM; different underlying error distributions

Mixed Effects Resources Mixed Effects Models and Extensions in Ecology with R (2009). Zuur, Ieno, Walker, Saveliev and Smith. Springer

Model selection? Check assumptions of the model (e.g., residuals and colinearity) Compare competing models (R. Thomas recommends comparing a gls (containing no random effects) to a linear effects mixed model to assess the importance of the random effect). Compare nested models using AIC OR: stepwise model refinement

The End!

Presenting examples (how many?) – How many types of models (nested- repeated measures, split-plot designs, nonlinear, linear) – Page 102 (online) and 71 (book) of Zuur – BDRipley 271 (pdf) – Random slope vs intercept models Relate to R code / packages? – LME4 and NLME

General/Generalised linear model General/Generalised additive model (GAM): identify smoothed lines of best fit through a dataset. A non-parametric smoothed relationship is chosen to fit a curve. – Non-Gaussian error distributions can also be chosen as with GLM Generalised least squares (GLS): incorporates a random term that takes into account heteroskedasticity (non-homogenous variance and/or autocorrelation structures) – Can use gls function in nlme package – Multiple variance structures to pick from

General/Generalised linear mixed modeling – nlme; lme4; asreml – Model fitting “ML” (Maximum likelihood): common with GLM “REML” (Restricted Maximum likelihood): corrects ML estimation for the number of fixed covariates. Less influenced by outliers than ML estimates – Structure Random intercept (same autocorrelation function for all levels of fixed factors) Random intercept + slope (autocorrelation function varies across different levels of the fixed factor) Random slope and > 1 random effect Random effect only aside from the intercept (useful as a null model to evaluate the importance of fixed effects in a GLMM) Fixed factors only (not really a mixed model, but useful as a null model to evaluate the importance of random effects in a GLMM) Generalised additive mixed modeling

Model 5: Random effect, no fixed effect y i = α + b i + ε j with ε j ~ N(0, σ 2 ) model5 <-- lme(richness ~1, random = ~1|beach, method = “RMEL”, data) i.e. a model that fits the mean value for each level of the random factor (fitted by REML by default) y x From Rob Thomas