These slides illustrate a few example R commands that can be useful for the analysis of repeated measures data.
|
|
- Philip Daniels
- 5 years ago
- Views:
Transcription
1 These slides illustrate a few example R commands that can be useful for the analysis of repeated measures data. We focus on the experiment designed to compare the effectiveness of three strength training programs. 1
2 #Read the data d=read.delim(" ~dnett/s511/repeatedmeasures.txt") head(d) Program Subj Time Strength
3 #Create factors d$program=as.factor(d$program) d$subj=as.factor(d$subj) d$timef=as.factor(d$time) head(d) Program Subj Time Strength Timef
4 # Compute sample means means = tapply(d$strength,list(d$time,d$program),mean) means
5 # Make a profile plot of the means x.axis = unique(d$time) par(fin=c(6.0,6.0),pch=18,mkh=.1,mex=1.5, cex=1.2,lwd=3) matplot(c(2,14), c(79,85.7), type="n", xlab="time(days)", ylab="strength", main= "Observed Strength Means") matlines(x.axis,means,type='l',lty=c(1,2,3)) matpoints(x.axis,means, pch=c(16,17,15)) legend(2.1,85.69,legend=c("ri program", 'WI Program','Controls'), lty=c(1,2,3),col=1:3,bty='n') 5
6 6
7 The following code illustrates how to specify different models for the variance-covariance of the response vector. We will begin with each model specification followed by a description of the model variancecovariance matrix associated with that model specification. Then output from each model fit will be examined. At first, we will assume the same structure for the mean in each case (one mean for each combination of program and time, a cell means model). Later we will look into different models for the mean. 7
8 This code fits a linear mixed effects model with independent random effects for each subject. The resulting variance-covariance structure for the response vector is block diagonal. Each block has a compound symmetric structure. There is one block for each subject. lme(strength ~ Program*Timef,data=d, random= ~ 1 Subj) 8
9 Var(y) is block diagonal with blocks σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σs 2 σe 2 + σs 2 9
10 This code fits a general linear model. The variancecovariance structure for the response vector is block diagonal. Each block has a compound symmetric structure. There is one block for each subject. This code fits a model for the response vector that is identical to the model obtained using the previous lme code. gls(strength ~ Program*Timef,data=d, correlation = corcompsymm(form=~1 Subj)) 10
11 Var(y) is block diagonal with blocks 1 ρ ρ ρ ρ ρ ρ ρ 1 ρ ρ ρ ρ ρ ρ ρ 1 ρ ρ ρ ρ σ 2 ρ ρ ρ 1 ρ ρ ρ ρ ρ ρ ρ 1 ρ ρ ρ ρ ρ ρ ρ 1 ρ ρ ρ ρ ρ ρ ρ 1 To match with previous variance components, note that σ 2 = σ 2 e + σ 2 s σ 2 ρ = σ 2 s ρ = σ2 s σ 2 = σ2 s. σe 2 + σs 2 11
12 This code fits a general linear model. The variancecovariance structure for the response vector is block diagonal. Each block has an AR(1) structure. There is one block for each subject. gls(strength ~ Program*Timef,data=d, correlation = corar1(form=~1 Subj)) 12
13 Var(y) is block diagonal with blocks 1 ρ ρ 2 ρ 3 ρ 4 ρ 5 ρ 6 ρ 1 ρ ρ 2 ρ 3 ρ 4 ρ 5 ρ 2 ρ 1 ρ ρ 2 ρ 3 ρ 4 σ 2 ρ 3 ρ 2 ρ 1 ρ ρ 2 ρ 3 ρ 4 ρ 3 ρ 2 ρ 1 ρ ρ 2 ρ 5 ρ 4 ρ 3 ρ 2 ρ 1 ρ ρ 6 ρ 5 ρ 4 ρ 3 ρ 2 ρ 1 13
14 This code fits a general linear model. The variancecovariance structure for the response vector is block diagonal. Each block is a general symmetric, positive definite variance-covariance matrix. There is one block for each subject. gls(strength ~ Program*Timef,data=d, correlation = corsymm(form=~1 Subj), weight = varident(form = ~ 1 Timef)) 14
15 Var(y) is block diagonal with blocks 1 σ 2 diag(δ 1,..., δ 7 ) 1 ρ ij ρ ij 1 1 diag(δ 1,..., δ 7 ) 15
16 = σ 2 δ 2 1 δ2 2 δ3 2 δ4 2 δ 2 5 ρ ij δ i δ j ρ ij δ i δ j δ 2 6 Identifiability Constraint : δ 1 1 δ
17 To understand the reason for an identifiability constraint, notice that an arbitrary positive definite 7 7 covariance matrix depends on only = 7(7 + 1) 2 = 28 parameters. However, we have σ 2, = 21 ρ ij parameters, and δ 1,..., δ 7. That s 29 parameters for a symmetric positive definite matrix that depends on at most 28 parameters. 17
18 Thus, R chooses to set δ 1 to 1. Without such a constraint, it is easy to use different values of the parameters to define the same matrix. For example, [ ] [ ] 1 1 = 3 3 = σ δ δ 2 7 ρ [ ] 18
19 If you are interested in learning about how to fit other variance-covariance structures in R, the following help commands will be useful.?corclasses?varclasses?pdclasses 19
20 # Use the lme function. This application # assumes that each subject has a different # identification value library(nlme) d.lme = lme(strength ~ Program*Timef, random= ~ 1 Subj, data=d, method="reml") summary(d.lme) Linear mixed-effects model fit by REML Data: d AIC BIC loglik Random effects: Formula: ~1 Subj (Intercept) Residual StdDev:
21 Fixed effects: Strength ~ Program * Timef Value Std.Error DF t-value p-value (Intercept) Program Program Timef Timef Timef Timef Timef Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef
22 Number of Observations: 399 Number of Groups: 57 anova(d.lme) numdf dendf F-value p-value (Intercept) <.0001 Program Timef <.0001 Program:Timef
23 # Use the gls( ) function to fit a # model where the errors have a # compound symmetry covariance structure # within subjects. Random effects are # not used to induce correlation. d.glscs = gls(strength ~ Program*Timef,data=d, correlation = corcompsymm(form=~1 Subj), method="reml") summary(d.glscs) Generalized least squares fit by REML Model: Strength ~ Program * Timef Data: d AIC BIC loglik
24 Correlation Structure: Compound symmetry Formula: ~1 Subj Parameter estimate(s): Rho Coefficients: Value Std.Error t-value p-value (Intercept) Program Program Timef Timef Timef Timef Timef Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef
25 Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Residual standard error: Degrees of freedom: 399 total; 378 residual anova(d.glscs) Denom. DF: 378 numdf F-value p-value (Intercept) <.0001 Program Timef <.0001 Program:Timef
26 # Try an auto regressive covariance # structures across time within # subjects d.glsar = gls(strength ~ Program*Timef,data=d, correlation = corar1(form=~1 Subj), method="reml") summary(d.glsar) Generalized least squares fit by REML Model: Strength ~ Program * Timef Data: d AIC BIC loglik Correlation Structure: AR(1) Formula: ~1 Subj Parameter estimate(s): Phi
27 Coefficients: Value Std.Error t-value p-value (Intercept) Program Program Timef Timef Timef Timef Timef Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef
28 Program2:Timef Program3:Timef Residual standard error: Degrees of freedom: 399 total; 378 residual anova(d.glsar) Denom. DF: 378 numdf F-value p-value (Intercept) <.0001 Program Timef Program:Timef
29 # Use an arbitray covariance matrix for # observations at different time # points within subjects d.gls = gls(strength ~ Program*Timef,data=d, correlation = corsymm(form=~1 Subj), weight = varident(form = ~ 1 Timef), method="reml") summary(d.gls) Generalized least squares fit by REML Model: Strength ~ Program * Timef Data: d AIC BIC loglik
30 Correlation Structure: General Formula: ~1 Subj Parameter estimate(s): Correlation:
31 Variance function: Structure: Different standard deviations per stratum Formula: ~1 Timef Parameter estimates:
32 Coefficients: Value Std.Error t-value p-value (Intercept) Program Program Timef Timef Timef Timef Timef Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef Program2:Timef Program3:Timef
33 Program2:Timef Program3:Timef Residual standard error: Degrees of freedom: 399 total; 378 residual anova(d.gls) Denom. DF: 378 numdf F-value p-value (Intercept) <.0001 Program Timef <.0001 Program:Timef
34 # Compare the fit of various covariance # structures. anova(d.gls, d.glscs) Model df AIC BIC loglik Test L.Ratio p-value d.gls d.glscs vs <.0001 anova(d.gls, d.glsar) Model df AIC BIC loglik Test L.Ratio p-value d.gls d.glsar vs
35 # Treat time as a continuous variable and # fit quadratic trends in strength # over time d.time = gls(strength ~ Program+Time+ Program*Time+I(Time^2)+Program*I(Time^2), data=d, correlation = corar1(form=~1 Subj), method="reml") summary(d.time) Generalized least squares fit by REML Model: Strength ~ Program + Time + Program * Time + I(Time^2) + Program * I(Time^2) Data: d AIC BIC loglik
36 Correlation Structure: AR(1) Formula: ~1 Subj Parameter estimate(s): Phi Coefficients: Value Std.Error t-value p-value (Intercept) Program Program Time I(Time^2) Program2:Time Program3:Time Program2:I(Time^2) Program3:I(Time^2)
37 Residual standard error: Degrees of freedom: 399 total; 390 residual anova(d.time) Denom. DF: 390 numdf F-value p-value (Intercept) <.0001 Program Time I(Time^2) Program:Time Program:I(Time^2)
38 # To compare the continuous time model to the # model where we fit a different mean at each # time point, we must compare likelihood values # instead of REML likelihood values. d.glsarmle = gls(strength ~ Program*Timef, data=d, correlation = corar1(form=~1 Subj), method="ml") d.timemle = gls(strength ~ Program+ Time+ Program*Time+I(Time^2)+Program*I(Time^2), data=d, correlation = corar1(form=~1 Subj), method="ml") anova(d.glsarmle, d.timemle) Model df AIC BIC loglik Test L.Ratio p-value d.glsarmle d.timemle vs
39 # Do not fit different quadratic trends # for different programs d.timemle = gls(strength ~ Program+Time+ Program*Time+I(Time^2), data=d, correlation = corar1(form=~1 Subj), method="ml") anova(d.glsarmle, d.timemle) Model df AIC BIC loglik Test L.Ratio p-value d.glsarmle d.timemle vs
40 # Fit a model with random regression coefficients # for individual subjects d.timer = lme(strength ~ Program+Time+ Program*Time+I(Time^2), random = ~ Time + I(Time^2) Subj, data=d, correlation = corar1(form=~1 Subj), control=list(msmaxiter=100), method="reml") 40
41 d.timer Linear mixed-effects model fit by REML Data: d Log-restricted-likelihood: Fixed: Strength ~ Program + Time + Program * Time + I(Time^2) (Intercept) Program2 Program3 Time I(Time^2) Program2:Time Program3:Time Random effects: Formula: ~Time + I(Time^2) Subj Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) (Intr) Time Time I(Time^2) Residual
42 Correlation Structure: AR(1) Formula: ~1 Subj Parameter estimate(s): Phi Number of Observations: 399 Number of Groups: 57 fixef(d.timer) (Intercept) Program2 Program3 Time I(Time^2) Program2:Time Program3:Time ranef(d.timer) (Intercept) Time I(Time^2) e e e e e-04 42
43 e e e e e e e e e e e e e e e e e e e e e-04 43
44 e e e e e e e e e e e e e e e e e e e e e-03 44
45 e e e e e e e e e e-03 coef(d.timer) (Intercept) Program2 Program3 Time I(Time^2) Program2:Time
46
47 Program3:Time
48
49
50 50
51 # Do we need the AR(1) structure in the # random coefficients model? d.timeru = lme(strength ~ Program+Time+ Program*Time+I(Time^2), random = ~ Time + I(Time^2) Subj, data=d, method="reml") anova(d.timer,d.timeru) Model df AIC BIC loglik Test L.Ratio p-value d.timer d.timeru vs e-04 # The more complicated model is preferred. # Keep the AR(1) structure. 51
Workshop 9.1: Mixed effects models
-1- Workshop 91: Mixed effects models Murray Logan October 10, 2016 Table of contents 1 Non-independence - part 2 1 1 Non-independence - part 2 11 Linear models Homogeneity of variance σ 2 0 0 y i = β
More informationWorkshop 9.3a: Randomized block designs
-1- Workshop 93a: Randomized block designs Murray Logan November 23, 16 Table of contents 1 Randomized Block (RCB) designs 1 2 Worked Examples 12 1 Randomized Block (RCB) designs 11 RCB design Simple Randomized
More informationHierarchical Linear Models (HLM) Using R Package nlme. Interpretation. 2 = ( x 2) u 0j. e ij
Hierarchical Linear Models (HLM) Using R Package nlme Interpretation I. The Null Model Level 1 (student level) model is mathach ij = β 0j + e ij Level 2 (school level) model is β 0j = γ 00 + u 0j Combined
More information13. October p. 1
Lecture 8 STK3100/4100 Linear mixed models 13. October 2014 Plan for lecture: 1. The lme function in the nlme library 2. Induced correlation structure 3. Marginal models 4. Estimation - ML and REML 5.
More informationRepeated measures, part 2, advanced methods
enote 12 1 enote 12 Repeated measures, part 2, advanced methods enote 12 INDHOLD 2 Indhold 12 Repeated measures, part 2, advanced methods 1 12.1 Intro......................................... 3 12.2 A
More informationSTAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data
STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data Berwin Turlach School of Mathematics and Statistics Berwin.Turlach@gmail.com The University of Western Australia Models
More informationIntroduction and Background to Multilevel Analysis
Introduction and Background to Multilevel Analysis Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background and
More informationLongitudinal Studies. Cross-Sectional Studies. Example: Y i =(Y it1,y it2,...y i,tni ) T. Repeatedly measure individuals followed over time
Longitudinal Studies Cross-Sectional Studies Repeatedly measure individuals followed over time One observation on each subject Sometimes called panel studies (e.g. Economics, Sociology, Food Science) Different
More informationCO2 Handout. t(cbind(co2$type,co2$treatment,model.matrix(~type*treatment,data=co2)))
CO2 Handout CO2.R: library(nlme) CO2[1:5,] plot(co2,outer=~treatment*type,layout=c(4,1)) m1co2.lis
More informationLecture 9 STK3100/4100
Lecture 9 STK3100/4100 27. October 2014 Plan for lecture: 1. Linear mixed models cont. Models accounting for time dependencies (Ch. 6.1) 2. Generalized linear mixed models (GLMM, Ch. 13.1-13.3) Examples
More informationIntruction to General and Generalized Linear Models
Intruction to General and Generalized Linear Models Mixed Effects Models IV Henrik Madsen Anna Helga Jónsdóttir hm@imm.dtu.dk April 30, 2012 Henrik Madsen Anna Helga Jónsdóttir (hm@imm.dtu.dk) Intruction
More informationStat 579: Generalized Linear Models and Extensions
Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 14 1 / 64 Data structure and Model t1 t2 tn i 1st subject y 11 y 12 y 1n1 2nd subject
More informationR Output for Linear Models using functions lm(), gls() & glm()
LM 04 lm(), gls() &glm() 1 R Output for Linear Models using functions lm(), gls() & glm() Different kinds of output related to linear models can be obtained in R using function lm() {stats} in the base
More informationSolution pigs exercise
Solution pigs exercise Course repeated measurements - R exercise class 2 November 24, 2017 Contents 1 Question 1: Import data 3 1.1 Data management..................................... 3 1.2 Inspection
More information20. REML Estimation of Variance Components. Copyright c 2018 (Iowa State University) 20. Statistics / 36
20. REML Estimation of Variance Components Copyright c 2018 (Iowa State University) 20. Statistics 510 1 / 36 Consider the General Linear Model y = Xβ + ɛ, where ɛ N(0, Σ) and Σ is an n n positive definite
More informationSTK4900/ Lecture 10. Program
STK4900/9900 - Lecture 10 Program 1. Repeated measures and longitudinal data 2. Simple analysis approaches 3. Random effects models 4. Generalized estimating equations (GEE) 5. GEE for binary data (and
More informationRandomized Block Designs with Replicates
LMM 021 Randomized Block ANOVA with Replicates 1 ORIGIN := 0 Randomized Block Designs with Replicates prepared by Wm Stein Randomized Block Designs with Replicates extends the use of one or more random
More informationOverview. 1. Independence. 2. Modeling Autocorrelation. 3. Temporal Autocorrelation Example. 4. Spatial Autocorrelation Example
6. Autocorrelation Overview 1. Independence 2. Modeling Autocorrelation 3. Temporal Autocorrelation Example 4. Spatial Autocorrelation Example 6.1 Independence 6.1 Independence. Model assumptions All linear
More informationRandom and Mixed Effects Models - Part III
Random and Mixed Effects Models - Part III Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Quasi-F Tests When we get to more than two categorical factors, some times there are not nice F tests
More informationExploring Hierarchical Linear Mixed Models
Exploring Hierarchical Linear Mixed Models 1/49 Last time... A Greenhouse Experiment testing C:N Ratios Sam was testing how changing the C:N Ratio of soil affected plant leaf growth. He had 3 treatments.
More information#Alternatively we could fit a model where the rail values are levels of a factor with fixed effects
examples-lme.r Tue Nov 25 12:32:20 2008 1 library(nlme) # The following data shows the results of tests carried over 6 rails. The response # indicated the time needed for a an ultrasonic wave to travel
More informationNon-independence due to Time Correlation (Chapter 14)
Non-independence due to Time Correlation (Chapter 14) When we model the mean structure with ordinary least squares, the mean structure explains the general trends in the data with respect to our dependent
More information22s:152 Applied Linear Regression. Returning to a continuous response variable Y...
22s:152 Applied Linear Regression Generalized Least Squares Returning to a continuous response variable Y... Ordinary Least Squares Estimation The classical models we have fit so far with a continuous
More informationTime-Series Regression and Generalized Least Squares in R*
Time-Series Regression and Generalized Least Squares in R* An Appendix to An R Companion to Applied Regression, third edition John Fox & Sanford Weisberg last revision: 2018-09-26 Abstract Generalized
More information22s:152 Applied Linear Regression. In matrix notation, we can write this model: Generalized Least Squares. Y = Xβ + ɛ with ɛ N n (0, Σ)
22s:152 Applied Linear Regression Generalized Least Squares Returning to a continuous response variable Y Ordinary Least Squares Estimation The classical models we have fit so far with a continuous response
More informationCovariance Models (*) X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed effects
Covariance Models (*) Mixed Models Laird & Ware (1982) Y i = X i β + Z i b i + e i Y i : (n i 1) response vector X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed
More informationFitting mixed models in R
Fitting mixed models in R Contents 1 Packages 2 2 Specifying the variance-covariance matrix (nlme package) 3 2.1 Illustration:.................................... 3 2.2 Technical point: why to use as.numeric(time)
More informationIntroduction to Hierarchical Data Theory Real Example. NLME package in R. Jiang Qi. Department of Statistics Renmin University of China.
Department of Statistics Renmin University of China June 7, 2010 The problem Grouped data, or Hierarchical data: correlations between subunits within subjects. The problem Grouped data, or Hierarchical
More informationIntroduction to General and Generalized Linear Models
Introduction to General and Generalized Linear Models Mixed effects models - II Henrik Madsen, Jan Kloppenborg Møller, Anders Nielsen April 16, 2012 H. Madsen, JK. Møller, A. Nielsen () Chapman & Hall
More informationOutline. Mixed models in R using the lme4 package Part 3: Longitudinal data. Sleep deprivation data. Simple longitudinal data
Outline Mixed models in R using the lme4 package Part 3: Longitudinal data Douglas Bates Longitudinal data: sleepstudy A model with random effects for intercept and slope University of Wisconsin - Madison
More informationRepeated Measures Design. Advertising Sales Example
STAT:5201 Anaylsis/Applied Statistic II Repeated Measures Design Advertising Sales Example A company is interested in comparing the success of two different advertising campaigns. It has 10 test markets,
More informationPart III: Linear mixed effects models
Part III: Linear mixed effects models 159 BIO 245, Spring 2018 Dental growth data Females Males Length, mm 16 18 20 22 24 26 28 30 32 11 11 4 3 2 11 4 7 11 4 3 3 2 8 4 8 5 8 58 7 1 7 5 6 9 57 2 1 9 12
More informationValue Added Modeling
Value Added Modeling Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background for VAMs Recall from previous lectures
More informationMIXED MODELS FOR REPEATED (LONGITUDINAL) DATA PART 2 DAVID C. HOWELL 4/1/2010
MIXED MODELS FOR REPEATED (LONGITUDINAL) DATA PART 2 DAVID C. HOWELL 4/1/2010 Part 1 of this document can be found at http://www.uvm.edu/~dhowell/methods/supplements/mixed Models for Repeated Measures1.pdf
More informationlme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept
lme4 Luke Chang Last Revised July 16, 2010 1 Using lme4 1.1 Fitting Linear Mixed Models with a Varying Intercept We will now work through the same Ultimatum Game example from the regression section and
More informationModelling the Covariance
Modelling the Covariance Jamie Monogan Washington University in St Louis February 9, 2010 Jamie Monogan (WUStL) Modelling the Covariance February 9, 2010 1 / 13 Objectives By the end of this meeting, participants
More informationover Time line for the means). Specifically, & covariances) just a fixed variance instead. PROC MIXED: to 1000 is default) list models with TYPE=VC */
CLP 944 Example 4 page 1 Within-Personn Fluctuation in Symptom Severity over Time These data come from a study of weekly fluctuation in psoriasis severity. There was no intervention and no real reason
More informationMixed effects models
Mixed effects models The basic theory and application in R Mitchel van Loon Research Paper Business Analytics Mixed effects models The basic theory and application in R Author: Mitchel van Loon Research
More informationRandom and Mixed Effects Models - Part II
Random and Mixed Effects Models - Part II Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Two-Factor Random Effects Model Example: Miles per Gallon (Neter, Kutner, Nachtsheim, & Wasserman, problem
More informationTechnische Universität München. Zentrum Mathematik. Linear Mixed Models Applied to Bank Branch Deposit Data
Technische Universität München Zentrum Mathematik Linear Mixed Models Applied to Bank Branch Deposit Data Project by Eike Christian Brechmann Supervisor: Prof. Claudia Czado, Ph.D. Tutor: Dr. Mathias Hofmann
More informationA brief introduction to mixed models
A brief introduction to mixed models University of Gothenburg Gothenburg April 6, 2017 Outline An introduction to mixed models based on a few examples: Definition of standard mixed models. Parameter estimation.
More informationPAPER 30 APPLIED STATISTICS
MATHEMATICAL TRIPOS Part III Wednesday, 5 June, 2013 9:00 am to 12:00 pm PAPER 30 APPLIED STATISTICS Attempt no more than FOUR questions, with at most THREE from Section A. There are SIX questions in total.
More informationIntroduction to Within-Person Analysis and RM ANOVA
Introduction to Within-Person Analysis and RM ANOVA Today s Class: From between-person to within-person ANOVAs for longitudinal data Variance model comparisons using 2 LL CLP 944: Lecture 3 1 The Two Sides
More informationTopic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model
Topic 17 - Single Factor Analysis of Variance - Fall 2013 One way ANOVA Cell means model Factor effects model Outline Topic 17 2 One-way ANOVA Response variable Y is continuous Explanatory variable is
More informationModelling finger force produced from different tasks using linear mixed models with lme R function
CS-BIGS: 6(1) 16-36 c 2015 CS-BIGS http://www.csbigs.fr Modelling finger force produced from different tasks using linear mixed models with lme R function Caroline Bazzoli Univ. Grenoble Alpes, LJK, F-38000
More informationModeling the Covariance
Modeling the Covariance Jamie Monogan University of Georgia February 3, 2016 Jamie Monogan (UGA) Modeling the Covariance February 3, 2016 1 / 16 Objectives By the end of this meeting, participants should
More informationStat 209 Lab: Linear Mixed Models in R This lab covers the Linear Mixed Models tutorial by John Fox. Lab prepared by Karen Kapur. ɛ i Normal(0, σ 2 )
Lab 2 STAT209 1/31/13 A complication in doing all this is that the package nlme (lme) is supplanted by the new and improved lme4 (lmer); both are widely used so I try to do both tracks in separate Rogosa
More informationMixed models in R using the lme4 package Part 7: Generalized linear mixed models
Mixed models in R using the lme4 package Part 7: Generalized linear mixed models Douglas Bates University of Wisconsin - Madison and R Development Core Team University of
More informationLongitudinal Data Analysis. with Mixed Models
SPIDA 09 Mixed Models with R Longitudinal Data Analysis with Mixed Models Georges Monette 1 June 09 e-mail: georges@yorku.ca web page: http://wiki.math.yorku.ca/spida_09 1 with thanks to many contributors:
More informationMixed models with correlated measurement errors
Mixed models with correlated measurement errors Rasmus Waagepetersen October 9, 2018 Example from Department of Health Technology 25 subjects where exposed to electric pulses of 11 different durations
More informationMixed models in R using the lme4 package Part 5: Generalized linear mixed models
Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Douglas Bates Madison January 11, 2011 Contents 1 Definition 1 2 Links 2 3 Example 7 4 Model building 9 5 Conclusions 14
More informationOutline. Mixed models in R using the lme4 package Part 5: Generalized linear mixed models. Parts of LMMs carried over to GLMMs
Outline Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Douglas Bates University of Wisconsin - Madison and R Development Core Team UseR!2009,
More informationSimulation and Analysis of Data from a Classic Split Plot Experimental Design
Simulation and Analysis of Data from a Classic Split Plot Experimental Design 1 Split-Plot Experimental Designs Field Plot Block 1 Block 2 Block 3 Block 4 Genotype C Genotype B Genotype A Genotype B Genotype
More informationSolution to Series 6
Dr. M. Dettling Applied Series Analysis SS 2014 Solution to Series 6 1. a) > r.bel.lm summary(r.bel.lm) Call: lm(formula = NURSING ~., data = d.beluga) Residuals: Min 1Q
More informationDe-mystifying random effects models
De-mystifying random effects models Peter J Diggle Lecture 4, Leahurst, October 2012 Linear regression input variable x factor, covariate, explanatory variable,... output variable y response, end-point,
More informationSubject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study
Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study 1.4 0.0-6 7 8 9 10 11 12 13 14 15 16 17 18 19 age Model 1: A simple broken stick model with knot at 14 fit with
More informationCoping with Additional Sources of Variation: ANCOVA and Random Effects
Coping with Additional Sources of Variation: ANCOVA and Random Effects 1/49 More Noise in Experiments & Observations Your fixed coefficients are not always so fixed Continuous variation between samples
More informationMixed models in R using the lme4 package Part 5: Generalized linear mixed models
Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Douglas Bates 2011-03-16 Contents 1 Generalized Linear Mixed Models Generalized Linear Mixed Models When using linear mixed
More informationOutline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form
Outline Statistical inference for linear mixed models Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark general form of linear mixed models examples of analyses using linear mixed
More informationLongitudinal Data Analysis
Longitudinal Data Analysis Mike Allerhand This document has been produced for the CCACE short course: Longitudinal Data Analysis. No part of this document may be reproduced, in any form or by any means,
More informationWeek 8, Lectures 1 & 2: Fixed-, Random-, and Mixed-Effects models
Week 8, Lectures 1 & 2: Fixed-, Random-, and Mixed-Effects models 1. The repeated measures design, where each of n Ss is measured k times, is a popular one in Psych. We approach this design in 2 ways:
More informationSAS Syntax and Output for Data Manipulation: CLDP 944 Example 3a page 1
CLDP 944 Example 3a page 1 From Between-Person to Within-Person Models for Longitudinal Data The models for this example come from Hoffman (2015) chapter 3 example 3a. We will be examining the extent to
More informationIntroduction to the Analysis of Hierarchical and Longitudinal Data
Introduction to the Analysis of Hierarchical and Longitudinal Data Georges Monette, York University with Ye Sun SPIDA June 7, 2004 1 Graphical overview of selected concepts Nature of hierarchical models
More informationSAS Syntax and Output for Data Manipulation:
CLP 944 Example 5 page 1 Practice with Fixed and Random Effects of Time in Modeling Within-Person Change The models for this example come from Hoffman (2015) chapter 5. We will be examining the extent
More informationIntroduction to SAS proc mixed
Faculty of Health Sciences Introduction to SAS proc mixed Analysis of repeated measurements, 2017 Julie Forman Department of Biostatistics, University of Copenhagen 2 / 28 Preparing data for analysis The
More informationReview of Unconditional Multilevel Models for Longitudinal Data
Review of Unconditional Multilevel Models for Longitudinal Data Topics: Course (and MLM) overview Concepts in longitudinal multilevel modeling Model comparisons and significance testing Describing within-person
More informationMixed Effects Models
Mixed Effects Models What is the effect of X on Y What is the effect of an independent variable on the dependent variable Independent variables are fixed factors. We want to measure their effect Random
More informationlme and nlme Mixed-Effects Methods and Classes for S and S-PLUS Version 3.0 October 1998 by José C. Pinheiro and Douglas M. Bates
lme and nlme Mixed-Effects Methods and Classes for S and S-PLUS Version 3.0 October 1998 by José C. Pinheiro and Douglas M. Bates Bell Labs, Lucent Technologies and University of Wisconsin Madison nlme
More informationOutline for today. Two-way analysis of variance with random effects
Outline for today Two-way analysis of variance with random effects Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark Two-way ANOVA using orthogonal projections March 4, 2018 1 /
More informationIntroduction to SAS proc mixed
Faculty of Health Sciences Introduction to SAS proc mixed Analysis of repeated measurements, 2017 Julie Forman Department of Biostatistics, University of Copenhagen Outline Data in wide and long format
More informationThe Problem. Regression With Correlated Errors. Generalized Least Squares. Correlated Errors. Consider the typical regression model.
The Problem Regression With Correlated Errors Consider the typical regression model y t = β z t + x t where x t is a process with covariance function γ(s, t). The matrix formulation is y = Z β + x where
More informationStat 5303 (Oehlert): Balanced Incomplete Block Designs 1
Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1 > library(stat5303libs);library(cfcdae);library(lme4) > weardata
More informationDescribing Within-Person Fluctuation over Time using Alternative Covariance Structures
Describing Within-Person Fluctuation over Time using Alternative Covariance Structures Today s Class: The Big Picture ACS models using the R matrix only Introducing the G, Z, and V matrices ACS models
More informationCorrelated Data: Linear Mixed Models with Random Intercepts
1 Correlated Data: Linear Mixed Models with Random Intercepts Mixed Effects Models This lecture introduces linear mixed effects models. Linear mixed models are a type of regression model, which generalise
More informationREPEATED MEASURES. Copyright c 2012 (Iowa State University) Statistics / 29
REPEATED MEASURES Copyright c 2012 (Iowa State University) Statistics 511 1 / 29 Repeated Measures Example In an exercise therapy study, subjects were assigned to one of three weightlifting programs i=1:
More informationAdvanced Applied Statistics A computer session Jianqing Fan
Advanced Applied Statistics A computer session Jianqing Fan All data are recorded in the /.Data directory. Creating a directory.data in a subdirectory will enable you to record data in this subdirectory.
More informationRepeated Measures ANOVA Multivariate ANOVA and Their Relationship to Linear Mixed Models
Repeated Measures ANOVA Multivariate ANOVA and Their Relationship to Linear Mixed Models EPSY 905: Multivariate Analysis Spring 2016 Lecture #12 April 20, 2016 EPSY 905: RM ANOVA, MANOVA, and Mixed Models
More informationITSx: Policy Analysis Using Interrupted Time Series
ITSx: Policy Analysis Using Interrupted Time Series Week 3 Slides Michael Law, Ph.D. The University of British Columbia Layout of the weeks 1. Introduction, setup, data sources 2. Single series interrupted
More informationLinear Mixed Models. Appendix to An R and S-PLUS Companion to Applied Regression. John Fox. May 2002
Linear Mixed Models Appendix to An R and S-PLUS Companion to Applied Regression John Fox May 22 1 Introduction The normal linear model (described, for example, in Chapter 4 of the text), y i = β 1 x 1i
More informationStat 579: Generalized Linear Models and Extensions
Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 12 1 / 34 Correlated data multivariate observations clustered data repeated measurement
More information36-402/608 Homework #10 Solutions 4/1
36-402/608 Homework #10 Solutions 4/1 1. Fixing Breakout 17 (60 points) You must use SAS for this problem! Modify the code in wallaby.sas to load the wallaby data and to create a new outcome in the form
More informationNon-Gaussian Response Variables
Non-Gaussian Response Variables What is the Generalized Model Doing? The fixed effects are like the factors in a traditional analysis of variance or linear model The random effects are different A generalized
More informationSpatial inference. Spatial inference. Accounting for spatial correlation. Multivariate normal distributions
Spatial inference I will start with a simple model, using species diversity data Strong spatial dependence, Î = 0.79 what is the mean diversity? How precise is our estimate? Sampling discussion: The 64
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More information8. Nonstandard standard error issues 8.1. The bias of robust standard errors
8.1. The bias of robust standard errors Bias Robust standard errors are now easily obtained using e.g. Stata option robust Robust standard errors are preferable to normal standard errors when residuals
More informationAdvantages of Mixed-effects Regression Models (MRM; aka multilevel, hierarchical linear, linear mixed models) 1. MRM explicitly models individual
Advantages of Mixed-effects Regression Models (MRM; aka multilevel, hierarchical linear, linear mixed models) 1. MRM explicitly models individual change across time 2. MRM more flexible in terms of repeated
More informationMA 575 Linear Models: Cedric E. Ginestet, Boston University Mixed Effects Estimation, Residuals Diagnostics Week 11, Lecture 1
MA 575 Linear Models: Cedric E Ginestet, Boston University Mixed Effects Estimation, Residuals Diagnostics Week 11, Lecture 1 1 Within-group Correlation Let us recall the simple two-level hierarchical
More informationSTAT 5200 Handout #23. Repeated Measures Example (Ch. 16)
Motivating Example: Glucose STAT 500 Handout #3 Repeated Measures Example (Ch. 16) An experiment is conducted to evaluate the effects of three diets on the serum glucose levels of human subjects. Twelve
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More informationAssessing the consequences of environmental impacts: variation in species responses has unpredictable functional effects
The following supplement accompanies the article Assessing the consequences of environmental impacts: variation in species responses has unpredictable functional effects Fiona Murray*, Stephen Widdicombe,
More informationMixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions
Mixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions Douglas Bates Department of Statistics University of Wisconsin - Madison Madison January 11, 2011
More informationAdditional Notes: Investigating a Random Slope. When we have fixed level-1 predictors at level 2 we show them like this:
Ron Heck, Summer 01 Seminars 1 Multilevel Regression Models and Their Applications Seminar Additional Notes: Investigating a Random Slope We can begin with Model 3 and add a Random slope parameter. If
More informationSerial Correlation. Edps/Psych/Stat 587. Carolyn J. Anderson. Fall Department of Educational Psychology
Serial Correlation Edps/Psych/Stat 587 Carolyn J. Anderson Department of Educational Psychology c Board of Trustees, University of Illinois Fall 017 Model for Level 1 Residuals There are three sources
More informationRandom Coefficients Model Examples
Random Coefficients Model Examples STAT:5201 Week 15 - Lecture 2 1 / 26 Each subject (or experimental unit) has multiple measurements (this could be over time, or it could be multiple measurements on a
More informationGeneralized Linear Mixed-Effects Models. Copyright c 2015 Dan Nettleton (Iowa State University) Statistics / 58
Generalized Linear Mixed-Effects Models Copyright c 2015 Dan Nettleton (Iowa State University) Statistics 510 1 / 58 Reconsideration of the Plant Fungus Example Consider again the experiment designed to
More information17. Example SAS Commands for Analysis of a Classic Split-Plot Experiment 17. 1
17 Example SAS Commands for Analysis of a Classic SplitPlot Experiment 17 1 DELIMITED options nocenter nonumber nodate ls80; Format SCREEN OUTPUT proc import datafile"c:\data\simulatedsplitplotdatatxt"
More informationEnd-Semester Examination MA 373 : Statistical Analysis on Financial Data
End-Semester Examination MA 373 : Statistical Analysis on Financial Data Instructor: Dr. Arabin Kumar Dey, Department of Mathematics, IIT Guwahati Note: Use the results in Section- III: Data Analysis using
More informationHow to make R, PostGIS and QGis cooperate for statistical modelling duties
How to make R, PostGIS and QGis cooperate for statistical modelling duties a case study on hedonic regressions Olivier Bonin UPE IFSTTAR LVMT OGRS 2012 Modelling requirements Hedonic models In an hedonic
More information36-309/749 Experimental Design for Behavioral and Social Sciences. Dec 1, 2015 Lecture 11: Mixed Models (HLMs)
36-309/749 Experimental Design for Behavioral and Social Sciences Dec 1, 2015 Lecture 11: Mixed Models (HLMs) Independent Errors Assumption An error is the deviation of an individual observed outcome (DV)
More informationIntroduction to Linear Mixed Models: Modeling continuous longitudinal outcomes
1/64 to : Modeling continuous longitudinal outcomes Dr Cameron Hurst cphurst@gmail.com CEU, ACRO and DAMASAC, Khon Kaen University 4 th Febuary, 2557 2/64 Some motivational datasets Before we start, I
More information