Statistical Analysis of Hierarchical Data. David Zucker Hebrew University, Jerusalem, Israel

Size: px
Start display at page:

Download "Statistical Analysis of Hierarchical Data. David Zucker Hebrew University, Jerusalem, Israel"

Transcription

1 Statistical Analysis of Hierarchical Data David Zucker Hebrew University, Jerusalem, Israel

2 Unit 1 Linear Mixed Models 1

3 Examples of Hierarchical Data Hierarchical data = subunits within units Students within schools Eyes within patients Measurements within subjects in repeated measures data (longitudinal data) 2

4 Examples of Linear Mixed Models 1. One-way ANOVA With Random Effect Y ij = µ + a i + ɛ ij a i N(0, σ 2 a), ɛ ij N(0, σ 2 ɛ ) 2. A Fixed Group Effect and a Random Cluster Effect Y ij = µ + βx i + a i + ɛ ij X i = 1 for treatment, X i = 0 for control 3. More General Regression Effects Y ij = µ + p k=1 β kx ijk + a i + ɛ ij 4. More Than One Level Y ijk = µ + p l=1 β jx ijkl + a i + b ij + ɛ ijk 3

5 Examples of Linear Mixed Models Continued 5. Random Line With a Group Effect Y ij = γ 1i + γ 2i t ij + ɛ ij γ 1i = β (1) 0 + β (1) 1 X i + b 1i γ 2i = β (2) 0 + β (2) 1 X i + b 2i b N(0, G) Y ij = [β (1) 0 + β (1) 1 X i] + [β (2) 0 + β (2) 1 X i]t ij + [b 1i + b 2i t ij ] + ɛ ij 4

6 General Form of Linear Mixed Model Y ij = x T ijβ + z T ijb i + ɛ ij b i N(0, G(θ (1) )) ɛ i N(0, R i (θ (2) )) in matrix form Y i = X i β + Z i b i + ɛ i Y i N(X i β, V i (θ)) V i (θ) = Z i G(θ (1) )Z T i + R i (θ (2) ) 5

7 Random Line Example in General LMM Form random line model Y ij = [β (1) 0 + β (1) 1 X i] + [β (2) 0 + β (2) 1 X i]t ij + [b 1i + b 2i t ij ] + ɛ ij representation in general LMM form Y ij = x T ijβ + z T ijb i + ɛ ij x T ij = [1, X i, t ij, X i t ij ] β T = [β (1) 0, β(1) 1, β(2) 0, β(2) 1 ] z T ij = [1, t ij ] b i = [b 1i, b 2i ] 6

8 Statistical Inference for Parameters Estimation Maximum Likelihood Large Sample Distribution φ = (β, θ) ˆφ φ N(0, Ω( ˆφ)) Ω(φ) = inverse Fisher information matrix 7

9 Inference for Individual Fixed-Effect Coefficients Regard ˆβ j β j Ω ββ jj as being approximately normally distributed, or approximately t-distributed with d d.f. Choice of d: Various methods available DDFM option in SAS PROC MIXED DDFM=SAT uses Satterthwaite approximation the SPSS MIXED procedure also uses the Satterthwaite approximation 8

10 Inference for Individual Coefficients Continued Testing H 0 : β j = 0: Reject if ˆβ j Ω ββ jj t d (1 α 2 ) Confidence interval for β j ˆβ j ± t d (1 α 2 ) Ω ββ jj 9

11 Testing a Single Linear Combination of Fixed Effects Look at ψ = c T β ˆψ = c T ˆβ N(ψ, c T Ω (ββ) c) Test H 0 : ψ = 0 using t-test with d d.f. Confidence interval for ψ ˆψ ± t d (1 α 2 ) c T Ω (ββ) c) Examples: 1. Expected response for a given set of covariate values 2. Treatment contrast 10

12 Testing Several Linear Combinations Look at φ = L T β, L T = m p matrix ˆφ = L T ˆβ N(φ, L T Ω (ββ) L) test H 0 : ψ = 0 using F -test with d.f. m and d F = ˆφ T (L T Ω (ββ) L) 1 ˆφ/m Example: Test for overall group effect in multiple group study 11

13 REML Estimation of Covariance Parameters Idea: Adjust the estimator of θ to take into account the estimation of β Similar to The Method: ˆσ 2 = 1 n n i=1 (Y i Ȳ )2 vs. ˆσ 2 = 1 n 1 n (Y i Ȳ )2 Let U be an n (n p) matrix of full rank such that U T X = 0 Then base estimation of θ on T = U T Y We have T N(0, U T V(θ)U) i=1 12

14 Software SAS: PROC MIXED SPSS: MIXED R: several procedures lme function it nlme package lmer function in lme4 package lmertest package for Satterthwaite degrees of freedom 13

15 Example Three groups of rats given different growth treatments and then followed over time Analysis in SAS PROC MIXED First model: proc mixed method=reml ratio covtest; class group; model response = group time group*time / solution ddfm=sat; random intercept time / subject=subject type=un; run; Second model: proc mixed method=reml ratio covtest; class group; model response = group time group*time / solution ddfm=sat; random intercept / subject=subject type=un; run; 14

16 1 GROUP=1 RESPONSE SUBJECT TIME

17 2 GROUP=2 RESPONSE SUBJECT TIME

18 3 GROUP=3 RESPONSE SUBJECT TIME

19 The SAS System 1 The Mixed Procedure First Analysis Model Information Data Set Dependent Variable Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.INDAT RESPONSE Unstructured SUBJECT REML Profile Model-Based Satterthwaite Class Level Information Class Levels Values GROUP Dimensions Covariance Parameters 4 Columns in X 8 Columns in Z per Subject 2 Subjects 50 Max Obs per Subject 7 Number of Observations Number of Observations Read 350 Number of Observations Used 252 Number of Observations Not Used 98 Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

20 The SAS System 2 The Mixed Procedure Covariance Parameter Estimates Cov Parm Subject Ratio Estimate Standard Error Z Value Pr Z UN(1,1) SUBJECT UN(2,1) SUBJECT UN(2,2) SUBJECT Residual <.0001 Fit Statistics -2 Res Log Likelihood AIC (Smaller is Better) AICC (Smaller is Better) BIC (Smaller is Better) Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq <.0001 Solution for Fixed Effects Effect GROUP Estimate Standard Error DF t Value Pr > t Intercept <.0001 GROUP GROUP GROUP TIME <.0001 TIME*GROUP TIME*GROUP TIME*GROUP Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F GROUP TIME <.0001 TIME*GROUP

21 The SAS System 1 The Mixed Procedure Second Analysis Model Information Data Set WORK.INDAT Dependent Variable RESPONSE ` Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method Unstructured SUBJECT REML Profile Model-Based Satterthwaite Class Level Information Class Levels Values GROUP Dimensions Covariance Parameters 2 Columns in X 8 Columns in Z per Subject 1 Subjects 50 Max Obs per Subject 7 Number of Observations Number of Observations Read 350 Number of Observations Used 252 Number of Observations Not Used 98 Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

22 The SAS System 2 The Mixed Procedure Covariance Parameter Estimates Cov Parm Subject Ratio Estimate Standard Error Z Value Pr > Z UN(1,1) SUBJECT <.0001 Residual <.0001 Fit Statistics -2 Res Log Likelihood AIC (Smaller is Better) AICC (Smaller is Better) BIC (Smaller is Better) Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq <.0001 Solution for Fixed Effects Effect GROUP Estimate Standard Error DF t Value Pr > t Intercept <.0001 GROUP GROUP GROUP TIME <.0001 TIME*GROUP TIME*GROUP TIME*GROUP Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F GROUP TIME <.0001 TIME*GROUP

23 Example Analysis in SPSS MIXED RESPONSE BY GROUP WITH TIME /FIXED=GROUP TIME GROUP*TIME SSTYPE(3) /METHOD=REML /RANDOM=INTERCEPT SUBJECT(SUBJECT) COVTYPE(VC) /PRINT=SOLUTION. 22

24 DATASET ACTIVATE DataSet1. MIXED RESPONSE BY GROUP WITH TIME /FIXED=GROUP TIME GROUP*TIME SSTYPE(3) /METHOD=REML /RANDOM=INTERCEPT SUBJECT(SUBJECT) COVTYPE(VC) /PRINT=SOLUTION. Mixed Model Analysis Notes Output Created Comments Input Missing Value Handling Syntax Resources [DataSet1] Active Dataset Filter Weight Split File N of Rows in Working Data File Definition of Missing Cases Used Processor Time Elapsed Time DataSet1 <none> <none> <none> 10-FEB :02: User-defined missing values are treated as missing. Statistics are based on all cases with valid data for all variables in the model. MIXED RESPONSE BY GROUP WITH TIME /FIXED=GROUP TIME GROUP*TIME SSTYPE(3) /METHOD=REML /RANDOM=INTERCEPT SUBJECT(SUBJECT) COVTYPE (VC) /PRINT=SOLUTION. 00:00: :00:00.23 Page 1

25 Fixed Effects Random Effects Residual Total Intercept GROUP TIME GROUP * TIME Intercept b Model Dimension a Number of Levels Covariance Structure Number of Parameters Variance Components 9 8 Subject Variables 1 SUBJECT 1 a. Dependent Variable: RESPONSE. b. As of version 11.5, the syntax rules for the RANDOM subcommand have changed. Your command syntax may yield results that differ from those produced by prior versions. If you are using version 11 syntax, please consult the current syntax reference guide for more information. Information Criteria a -2 Restricted Log Likelihood Akaike's Information Criterion (AIC) Hurvich and Tsai's Criterion (AICC) Bozdogan's Criterion (CAIC) Schwarz's Bayesian Criterion (BIC) The information criteria are displayed in smaller-is-better forms. a. Dependent Variable: RESPONSE. Fixed Effects Type III Tests of Fixed Effects a Source Intercept GROUP TIME GROUP * TIME Numerator df Denominator df F Sig a. Dependent Variable: RESPONSE. Page 2

26 Estimates of Fixed Effects a Parameter Estimate Std. Error df t Sig. 95%... Lower Bound Intercept [GROUP=1] [GROUP=2] [GROUP=3] 0 b TIME [GROUP=1] * TIME [GROUP=2] * TIME [GROUP=3] * TIME 0 b Estimates of Fixed Effects a Parameter Intercept [GROUP=1] [GROUP=2] [GROUP=3] TIME [GROUP=1] * TIME [GROUP=2] * TIME [GROUP=3] * TIME 95%... Upper Bound a. Dependent Variable: RESPONSE. b. This parameter is set to zero because it is redundant. Covariance Parameters Estimates of Covariance Parameters a Parameter Estimate Std. Error Residual Intercept [subject = SUBJECT] Variance a. Dependent Variable: RESPONSE Page 3

27 Example Analysis in R library(lme4) library(lmertest) grp1 = (GROUP==1) grp2 = (GROUP==2) as.numeric(grp1) as.numeric(grp2) grp1tim = grp1*time grp2tim = grp2*time reres1= lmer(response ~ grp1 + grp2 + TIME + grp1tim + grp2tim + (1 SUBJECT), REML=TRUE) summary(reres1, ddf="satterthwaite") 26

28 Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [mermodlmertest] Formula: RESPONSE ~ grp1 + grp2 + TIME + grp1tim + grp2tim + (1 SUBJECT) REML criterion at convergence: 1082 Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.Dev. SUBJECT (Intercept) Residual Number of obs: 252, groups: SUBJECT, 50 Fixed effects: Estimate Std. Error df t value Pr(> t ) (Intercept) <2e-16 *** grp1true grp2true TIME <2e-16 *** grp1tim grp2tim Signif. codes: 0 *** ** 0.01 * Correlation of Fixed Effects: (Intr) g1true g2true TIME grp1tm grp1true grp2true TIME grp1tim grp2tim

29 Example - Continued Examining Contrasts proc mixed; class group; model response = group time group*time / solution ddfm=sat; random intercept / subject=subject; estimate lincomb group / cl alpha=0.05; contrast lincomb1 group ; contrast lincomb2 group , group ; run; 28

30 Estimates Standard Label Estimate Error DF t Value Pr > t lincomb Alpha Lower Upper Contrasts Num Den Label DF DF F Value Pr > F lincomb lincomb

31 Contrasts in R Direct Computation Using Formulas reres1= lmer(response ~ grp1 + grp2 + TIME + grp1tim + grp2tim + (1 SUBJECT), REML=TRUE) beta = fixef(reres1) omega = vcov(reres1) l1 = c(0,-0.5,-0.5,0,0,0) psi1 = t(l1) %*% beta vpsi1 = t(l1) %*% omega %*% l1 sdpsi1 = sqrt(vpsi1) cbind(psi1,sdpsi1) l2t = rbind(c(0,1,0,0,0,0),c(0,0,1,0,0,0)) phi = l2t %*% beta mdlmat = solve(l2t %*% omega %*% t(l2t)) f = t(phi) %*% mdlmat %*% phi / nrow(l2t) Output: > ans psi1 sdpsi > f 1 x 1 Matrix of class "dgematrix" [,1] [1,]

32 Inference for Covariance Parameters Recall: ˆθ θ N(0, Ω θθ ) Wald Test of H 0 : θ j = 0: Z W ald j = ˆθ j / Wald CI: ˆθ j ± z 1 α/2 Ω θθ jj Ω θθ jj Handling Positivity Constraints on Covariance Parameters Satterthwaite approach: Use the approximation ˆθ j χ2 ν θ j ν with ν = 2(Zj W ald ) 2 (matching distn of ˆθ j on first two moments) Transformation and delta method (Taylor approximation): log ˆθ j N(log θ j, Ω θθ jj/ˆθ 2 j) 31

33 Covariance Structures Recall the model Y i = X i β + Z i b i + ɛ i b i N(0, G(θ (1) )) ɛ i N(0, R i (θ (2) )) Need to specify the forms of the matrices G(θ (1) ) and R(θ (2) ) RANDOM statement specifies structure of G(θ (1) ) TYPE=VC means the elements of b i are independent TYPE=UN means that G(θ (1) ) is unstructured (this is the usual choice) REPEATED statement specifies structure of R(θ (2) ) Default structure of R(θ (2) ) is σ 2 I Other structures are available for longitudinal or spatial data 32

34 Structures for R(θ (2) ) for Longitudinal Data Many structures offered in PROC MIXED are appropriate only for data sets where all individuals are measured at the same set of times (except for missing entries). E.g. VC structure: ɛ ij N(0, σj 2 ) independent across j Some available structures (referred to as spatial ) are appropriate for more general measurement schedules E.g., SP(EXP) structure: Cov(ɛ ij, ɛ ik ) = σ 2 exp( d ijk /θ) In time series terms, this is an AR(1) structure 33

35 Example of Analysis with SP(EXP) Structure proc mixed covtest cl; class group; model response = group time group*time / solution ddfm=sat; random intercept / subject=subject; repeated / subject=subject type=sp(exp)(time); run; 34

36 The SAS System 1 The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structures Subject Effects Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.INDAT RESPONSE Variance Components, Spatial Exponential SUBJECT, SUBJECT REML Profile Model-Based Satterthwaite Class Level Information Class Levels Values GROUP Dimensions Covariance Parameters 3 Columns in X 8 Columns in Z per Subject 1 Subjects 50 Max Obs per Subject 7 Number of Observations Number of Observations Read 350 Number of Observations Used 252 Number of Observations Not Used 98 Iteration History Iteration Evaluations -2 Res Log Like Criterion

37 The SAS System 2 The Mixed Procedure Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met. Covariance Parameter Estimates Cov Parm Subject Estimate Standard Error Z Value Pr > Z Alpha Lower Upper Intercept SUBJECT SP(EXP) SUBJECT Residual < Fit Statistics -2 Res Log Likelihood AIC (Smaller is Better) AICC (Smaller is Better) BIC (Smaller is Better) Solution for Fixed Effects Effect GROUP Estimate Standard Error DF t Value Pr > t Intercept <.0001 GROUP GROUP GROUP TIME <.0001 TIME*GROUP TIME*GROUP TIME*GROUP Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F GROUP TIME <.0001 TIME*GROUP

38 Heterogeneous Variances Allow variance of random effect to depend on group Allow variance of error term to depend on group proc mixed cl covtest; class group; model response = group time group*time / solution ddfm=sat; random intercept / subject=subject group=group; repeated / subject=subject group=group; run; 37

39 The SAS System 1 The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effects Group Effects Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.INDAT RESPONSE Variance Components SUBJECT, SUBJECT GROUP, GROUP REML None Model-Based Satterthwaite Class Level Information Class Levels Values GROUP Dimensions Covariance Parameters 6 Columns in X 8 Columns in Z per Subject 3 Subjects 50 Max Obs per Subject 7 Number of Observations Number of Observations Read 350 Number of Observations Used 252 Number of Observations Not Used 98 Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

40 The SAS System 2 The Mixed Procedure Covariance Parameter Estimates Cov Parm Subject Group Estimate Standard Error Z Value Pr > Z Alpha Lower Upper Intercept SUBJECT GROUP Intercept SUBJECT GROUP Intercept SUBJECT GROUP Residual SUBJECT GROUP < Residual SUBJECT GROUP < Residual SUBJECT GROUP < Fit Statistics -2 Res Log Likelihood AIC (Smaller is Better) AICC (Smaller is Better) BIC (Smaller is Better) Solution for Fixed Effects Effect GROUP Estimate Standard Error DF t Value Pr > t Intercept <.0001 GROUP GROUP GROUP TIME <.0001 TIME*GROUP TIME*GROUP TIME*GROUP Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F GROUP TIME <.0001 TIME*GROUP

41 Comparing Models Can compare models using likelihood ratio test: 1. Run larger model, extract 2 log L 2. Run smaller model, extract 2 log L 3. Compute G 2 = difference in the value of 2 log L 4. Test significance based on the chi-square distn with r d.f., r = the number of added parameters in the larger model Important note: If we are changing fixed effects, LR test is valid only with ML If we are changing only random effects, can use ML or REML Example: Model with homogenous variance structure: 2 log L = Model with heterogeneous variance structure: 2 log L = G 2 = 5.8, r = 4, p-value =

42 Nested Random Effects Example 2 groups (fixed effect) 4 schools per group (1st level random effect) 2 classes per school (2nd level random effect) 5 students per class proc mixed ratio covtest; class group school class; model score = group / solution ddfm=sat; random intercept / subject=school v; random intercept / subject=class(school); run; 41

43 The SAS System 1 The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effects Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.INDAT score Variance Components school, class(school) REML Profile Model-Based Satterthwaite Class Level Information Class Levels Values group school class Dimensions Covariance Parameters 3 Columns in X 3 Columns in Z per Subject 3 Subjects 8 Max Obs per Subject 10 Number of Observations Number of Observations Read 80 Number of Observations Used 80 Number of Observations Not Used 0 Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

44 The SAS System 2 The Mixed Procedure Estimated V Matrix for school 1 Row Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col Covariance Parameter Estimates Cov Parm Subject Ratio Estimate Standard Error Z Value Pr > Z Intercept school Intercept class(school) Residual <.0001 Fit Statistics -2 Res Log Likelihood AIC (Smaller is Better) AICC (Smaller is Better) BIC (Smaller is Better) Solution for Fixed Effects Effect group Estimate Standard Error DF t Value Pr > t Intercept group group Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F group

45 Estimation of Random Effects Y i b i N X iβ 0, V i GZ T i Z i G G b i Y i N(D i (Y i X i β), Q i ) ˆb i = D i (Y i X i β) Without the normality assumption, the above predictor is Best Linear Unbiased Predictor (BLUP), where best means minimum mean square error With estimates substituted for unknown parameters (as above), the term Empirical BLUP (EBLUP) is used 44

46 Estimation of Random Effects Continued Ignoring the estimation error in estimating the random effects parameters θ, we can write ˆβ β N(0, C) ˆb b C = C 11 C 12 C 21 C 22 where the C rs are matrices that can be written down 45

47 Prediction Intervals L T ˆβ β ˆb b N(0, L T CL) Prediction interval for L T β b is given by L T ˆβ ˆb ± z 1 α/2 [L T CL] 1/2 46

48 Example Gaucher s Disease Study Study of growth of children with Gaucher s disease Measurements are standardized height values Y ij = β 0 + β 1 t ij + β 3 X i + β 4 X i t ij + b i1 + b i2 t ij + ɛ j X i = group indicator (0/1) 47

49 proc mixed method=reml ratio covtest; model y = sex t sex*t / solution covb ddfm=satterth outpred=op; random int t / subject=id type=un; estimate pred1 intercept 1 t 1.5 sex 1 sex*t 1.5 intercept 1 t 1.5 / e sub ; 48

50 estimate pred2 intercept 1 t 3.5 sex 1 sex*t 3.5 intercept 1 t 3.5 / e sub ; run; proc print data=op; run; 49

51 The SAS System 1 Obs id t sex y

52 The SAS System 2 Obs id t sex y

53 The SAS System 3 Obs id t sex y

54 The SAS System 4 Obs id t sex y

55 The SAS System 5 The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.INDAT y Unstructured id REML Profile Model-Based Satterthwaite Dimensions Covariance Parameters 4 Columns in X 4 Columns in Z per Subject 2 Subjects 28 Max Obs per Subject 12 Number of Observations Number of Observations Read 136 Number of Observations Used 136 Number of Observations Not Used 0 Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

56 The SAS System 6 The Mixed Procedure Covariance Parameter Estimates Cov Parm Subject Ratio Estimate Standard Error Z Value Pr Z UN(1,1) id UN(2,1) id UN(2,2) id Residual <.0001 Fit Statistics -2 Res Log Likelihood 38.4 AIC (Smaller is Better) 46.4 AICC (Smaller is Better) 46.8 BIC (Smaller is Better) 51.8 Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq <.0001 Solution for Fixed Effects Effect Estimate Standard Error DF t Value Pr > t Intercept sex t sex*t Covariance Matrix for Fixed Effects Row Effect Col1 Col2 Col3 Col4 1 Intercept sex t sex*t

57 The SAS System 7 The Mixed Procedure Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F sex t sex*t Coefficients for pred1 Effect Subject Row1 Intercept 1 sex 1 t 1.5 sex*t 1.5 Intercept 1 1 t Intercept 2 t 2 Intercept 3 t 3 Intercept 4 t 4 Intercept 5 t 5 Intercept 6 t 6 Intercept 7 t 7 Intercept 8 t 8 Intercept 9 t 9 Intercept 10 t 10 Intercept 11 t 11 Intercept 12 t 12 Intercept 13

58 The SAS System 8 The Mixed Procedure Coefficients for pred1 Effect Subject Row1 t 13 Intercept 14 t 14 Intercept 15 t 15 Intercept 16 t 16 Intercept 17 t 17 Intercept 18 t 18 Intercept 19 t 19 Intercept 20 t 20 Intercept 21 t 21 Intercept 22 t 22 Intercept 23 t 23 Intercept 24 t 24 Intercept 25 t 25 Intercept 26 t 26 Intercept 27 t 27 Intercept 28 t 28

59 The SAS System 9 The Mixed Procedure Coefficients for pred2 Effect Subject Row1 Intercept 1 sex 1 t 3.5 sex*t 3.5 Intercept 1 1 t Intercept 2 t 2 Intercept 3 t 3 Intercept 4 t 4 Intercept 5 t 5 Intercept 6 t 6 Intercept 7 t 7 Intercept 8 t 8 Intercept 9 t 9 Intercept 10 t 10 Intercept 11 t 11 Intercept 12 t 12 Intercept 13 t 13 Intercept 14 t 14 Intercept 15 t 15 Intercept 16

60 The SAS System 10 The Mixed Procedure Coefficients for pred2 Effect Subject Row1 t 16 Intercept 17 t 17 Intercept 18 t 18 Intercept 19 t 19 Intercept 20 t 20 Intercept 21 t 21 Intercept 22 t 22 Intercept 23 t 23 Intercept 24 t 24 Intercept 25 t 25 Intercept 26 t 26 Intercept 27 t 27 Intercept 28 t 28 Estimates Label Estimate Standard Error DF t Value Pr > t pred pred

61 The SAS System 11 Obs id t sex y Pred StdErrPred DF Alpha Lower Upper Resid

62 The SAS System 12 Obs id t sex y Pred StdErrPred DF Alpha Lower Upper Resid

63 The SAS System 13 Obs id t sex y Pred StdErrPred DF Alpha Lower Upper Resid

64 The SAS System 14 Obs id t sex y Pred StdErrPred DF Alpha Lower Upper Resid

65 Example Fay-Herriot Model for Sample Surveys Y i = µ + b i + ɛ i b i N(0, τ 2 ), ɛ i N(0, σi 2 ), σi 2 known n n ˆµ = c i Y i / c i, c i = τ 2 /(τ 2 + σi 2 ) i=1 i=1 ˆbi = c i (Y i ˆµ) Ŷ i = ˆµ + ˆb i = (1 c i )ˆµ + c i Y i 64

66 Fay-Herriot Model Continued data fh_example; input area y sig2; sig = sqrt(sig2); cards; [SNIP] proc mixed; model y = / solution ddfm=bw; random intercept sig / subject=area type=vc solution; parms (1) (1) (1e-6) / hold=2,3; run; data newdat; set fh_example; muhat = ; tau2hat = ; wt = tau2hat/(tau2hat+sig2); bhat = wt*(y-muhat); ypred = (1-wt)*muhat + wt*y; proc print; run; 65

67 ' 1 The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.FH_EXAMPLE y Variance Components area REML Parameter Model-Based Between-Within Dimensions Covariance Parameters 3 Columns in X 1 Columns in Z per Subject 2 Subjects 22 Max Obs per Subject 1 Number of Observations Number of Observations Read 22 Number of Observations Used 22 Number of Observations Not Used 0 Parameter Search CovP1 CovP2 CovP3 Res Log Like -2 Res Log Like E Iteration History Iteration Evaluations -2 Res Log Like Criterion Convergence criteria met.

68 ' 2 The Mixed Procedure Covariance Parameter Estimates Cov Parm Subject Estimate Intercept area sig area Residual 1E-6 Fit Statistics -2 Res Log Likelihood 13.8 AIC (Smaller is Better) 15.8 AICC (Smaller is Better) 16.0 BIC (Smaller is Better) 16.9 PARMS Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq <.0001 Solution for Fixed Effects Effect Estimate Standard Error DF t Value Pr > t Intercept <.0001 Solution for Random Effects Effect Subject Estimate Std Err Pred DF t Value Pr > t Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept

69 ' 3 The Mixed Procedure Solution for Random Effects Effect Subject Estimate Std Err Pred DF t Value Pr > t sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig Intercept sig

70 ' 4 Obs area y x sig2 sig muhat tau2hat wt bhat ypred

71 Unit 2 Nonlinear Mixed Models 70

72 Example 1 Hospital Comparisons Want to compare hospitals with respect to surgical mortality rates Response variable: alive or dead Have data on a number of hospitals Want to analyze variation across hospitals Want to account for patient-level factors ( case mix ) 71

73 Example 2 Toxicology Study female mice assigned to different doses of a chemical fetuses examined for malformations Example 3 Booster Seat Study (HU Public Health School) 11 neighborhoods, average of 50 children sampled per neighborhood Response variable: child uses booster seat (yes/no) interested in effect of neighborhood-level variables effect of child-level variables variation across neighborhoods 72

74 Logistic Regression With Random Effect The Setup i = cluster (i = 1,..., n) j = individual within cluster (j = 1,..., J i ) Y ij = 0 1 binary response X ijk = value of explanatory variable k for individual ij (k = 1,..., p) We regard the X ijk s as fixed quantities. Clusters are assumed independent. The Concept Random effect b i used to express within-cluster dependence Responses within each cluster assumed conditionally independent given the b i s 73

75 Software SAS: PROC NLMIXED PROC GLMMIX NLMIXED is more flexible SPSS: GENLINMIXED Estimation is not by maximum likelihood, but instead by penalized quasi-likelihood, which is an inferior method R: glmer function in lme4 package The SAS procedures are superior to the R functions in terms of the options offered. 74

76 Model Specification Leads to p(x ij, β, b i ) = Pr(Y ij = 1 b i ) = exp(βt x ij + b i ) 1 + exp(β T x ij + b i ) f Yi b i (y i b i ) = Pr(Y ij = y ij, j = 1,..., J i b i ) = J i j=1 p(x ij, β, b i ) y ij (1 p(x ij, β, b i )) 1 y ij f bi (b i ) = σ 1 b φ(b i /σ b ) (i.e. b i N(0, σ 2 b)) f Yi (y i ) = Pr(Y ij = y ij, j = 1,..., J i ) J i = p(x ij, β, b i ) y ij (1 p(x ij, β, b i )) 1 y ij σ 1 b φ(b i /σ b )db i = j=1 J i p(x ij, β, σ b ξ i ) y ij (1 p(x ij, β, σ b ξ i )) 1 y ij φ(ξ i )dξ i j=1 75

77 Computation of Integrals Laplace Approximation: valid if J i is large for all i Adaptive Gaussian Quadrature (AGQ) Simulation (offered only by SAS and not by R) 76

78 Statistical Inference for Parameters Estimation of φ = (β, σb 2 ): Maximum Likelihood (or REML) Large Sample Distribution Types of Inference ˆφ φ N(0, Ω( ˆφ)) Ω(φ) = inverse Fisher information matrix Inference for Individual Fixed-Effect Coefficients Testing a Single Linear Combination of Fixed Effects Testing Several Linear Combinations Similar to LMM case, with similar syntax in SAS PROC NLMIXED Also: Wald test for significance of σ 2 b Confidence interval for σ 2 b 77

79 Estimation of Random Effects By Bayes theorem, the conditional density of b i given Y i is given by f bi Y i (b i Y i ) = f Y i b i (Y i b i )f bi (b i ) f Yi (Y i ) Expressions for the quantities on the right side have been given previously. In principle, we could estimate b i using bi f Yi b ˆbi = E[b i Y i ] = i (Y i b i )f bi (b i )db i f Yi (Y i ) and we could use f bi Y i (b i Y i ) to compute an empirical Bayes 95% credible interval for b i. SAS PROC NLMIXED and the R package lme4 use an approximate method, valid for large J i. 78

80 Estimation of Random Effects Continued Let b i be the value of b that maximizes f b i Y i (b Y i ) (posterior mode). Define ḡ i (b) = J 1 i log(f bi (b)f Yi b i (Y i b)) Finally, define v i = ḡ i (b i ) 1 The approximation is then b i Y i N(b i, J 1 i v i ) 79

81 Estimation of Random Effects Continued Now, b i = b i (ψ). In practice, we have to substitute ˆψ for ψ. SAS PROC MIXED offers a correction for this. The R function lmer4 does not. Defining c = b i / ψ, the correction is as follows: Cov ˆψ Y i = Ω Ωc b i c T Ω Ji 1 v i + c T Ωc Using this result and the delta method, we can compute credible intervals for functions of ψ and b i, such as p(x, β, b i ) for a given x. 80

82 Example 1 Mortality rates in 12 hospitals performing cardiac surgery in babies proc nlmixed; parms beta=-2.5 sigb2=1; bounds sigb2 >=0; odds = exp(beta+bi); p = odds/(1+odds); model d ~ binomial(n,p); random bi ~ normal(0,sigb2) subject=hospital out=odat1; predict p out=odat2; run; proc print data=odat1; proc print data=odat2; run; 81

Subject-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 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 information

Contrasting Marginal and Mixed Effects Models Recall: two approaches to handling dependence in Generalized Linear Models:

Contrasting Marginal and Mixed Effects Models Recall: two approaches to handling dependence in Generalized Linear Models: Contrasting Marginal and Mixed Effects Models Recall: two approaches to handling dependence in Generalized Linear Models: Marginal models: based on the consequences of dependence on estimating model parameters.

More information

SAS Syntax and Output for Data Manipulation:

SAS 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 information

over Time line for the means). Specifically, & covariances) just a fixed variance instead. PROC MIXED: to 1000 is default) list models with TYPE=VC */

over 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 information

Introduction to SAS proc mixed

Introduction 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 information

Step 2: Select Analyze, Mixed Models, and Linear.

Step 2: Select Analyze, Mixed Models, and Linear. Example 1a. 20 employees were given a mood questionnaire on Monday, Wednesday and again on Friday. The data will be first be analyzed using a Covariance Pattern model. Step 1: Copy Example1.sav data file

More information

Daniel J. Bauer & Patrick J. Curran

Daniel J. Bauer & Patrick J. Curran GET FILE='C:\Users\dan\Dropbox\SRA\antisocial.sav'. >Warning # 5281. Command name: GET FILE >SPSS Statistics is running in Unicode encoding mode. This file is encoded in >a locale-specific (code page)

More information

UNIVERSITY OF TORONTO. Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS. Duration - 3 hours. Aids Allowed: Calculator

UNIVERSITY OF TORONTO. Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS. Duration - 3 hours. Aids Allowed: Calculator UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS Duration - 3 hours Aids Allowed: Calculator LAST NAME: FIRST NAME: STUDENT NUMBER: There are 27 pages

More information

Workshop 9.3a: Randomized block designs

Workshop 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 information

SAS Code for Data Manipulation: SPSS Code for Data Manipulation: STATA Code for Data Manipulation: Psyc 945 Example 1 page 1

SAS Code for Data Manipulation: SPSS Code for Data Manipulation: STATA Code for Data Manipulation: Psyc 945 Example 1 page 1 Psyc 945 Example page Example : Unconditional Models for Change in Number Match 3 Response Time (complete data, syntax, and output available for SAS, SPSS, and STATA electronically) These data come from

More information

SAS Syntax and Output for Data Manipulation: CLDP 944 Example 3a page 1

SAS 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 information

Statistical Inference: The Marginal Model

Statistical Inference: The Marginal Model Statistical Inference: The Marginal Model Edps/Psych/Stat 587 Carolyn J. Anderson Department of Educational Psychology c Board of Trustees, University of Illinois Fall 2017 Outline Inference for fixed

More information

Introduction to SAS proc mixed

Introduction 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 information

Analysis of Longitudinal Data: Comparison Between PROC GLM and PROC MIXED. Maribeth Johnson Medical College of Georgia Augusta, GA

Analysis of Longitudinal Data: Comparison Between PROC GLM and PROC MIXED. Maribeth Johnson Medical College of Georgia Augusta, GA Analysis of Longitudinal Data: Comparison Between PROC GLM and PROC MIXED Maribeth Johnson Medical College of Georgia Augusta, GA Overview Introduction to longitudinal data Describe the data for examples

More information

Outline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form

Outline. 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 information

Random Intercept Models

Random Intercept Models Random Intercept Models Edps/Psych/Soc 589 Carolyn J. Anderson Department of Educational Psychology c Board of Trustees, University of Illinois Spring 2019 Outline A very simple case of a random intercept

More information

MIXED 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 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 information

Correlated Data: Linear Mixed Models with Random Intercepts

Correlated 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 information

Random Coefficients Model Examples

Random 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 information

Designing Multilevel Models Using SPSS 11.5 Mixed Model. John Painter, Ph.D.

Designing Multilevel Models Using SPSS 11.5 Mixed Model. John Painter, Ph.D. Designing Multilevel Models Using SPSS 11.5 Mixed Model John Painter, Ph.D. Jordan Institute for Families School of Social Work University of North Carolina at Chapel Hill 1 Creating Multilevel Models

More information

Some general observations.

Some general observations. Modeling and analyzing data from computer experiments. Some general observations. 1. For simplicity, I assume that all factors (inputs) x1, x2,, xd are quantitative. 2. Because the code always produces

More information

Stat 579: Generalized Linear Models and Extensions

Stat 579: Generalized Linear Models and Extensions Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 15 1 / 38 Data structure t1 t2 tn i 1st subject y 11 y 12 y 1n1 Experimental 2nd subject

More information

Example 7b: Generalized Models for Ordinal Longitudinal Data using SAS GLIMMIX, STATA MEOLOGIT, and MPLUS (last proportional odds model only)

Example 7b: Generalized Models for Ordinal Longitudinal Data using SAS GLIMMIX, STATA MEOLOGIT, and MPLUS (last proportional odds model only) CLDP945 Example 7b page 1 Example 7b: Generalized Models for Ordinal Longitudinal Data using SAS GLIMMIX, STATA MEOLOGIT, and MPLUS (last proportional odds model only) This example comes from real data

More information

STAT 7030: Categorical Data Analysis

STAT 7030: Categorical Data Analysis STAT 7030: Categorical Data Analysis 5. Logistic Regression Peng Zeng Department of Mathematics and Statistics Auburn University Fall 2012 Peng Zeng (Auburn University) STAT 7030 Lecture Notes Fall 2012

More information

Review of CLDP 944: Multilevel Models for Longitudinal Data

Review of CLDP 944: Multilevel Models for Longitudinal Data Review of CLDP 944: Multilevel Models for Longitudinal Data Topics: Review of general MLM concepts and terminology Model comparisons and significance testing Fixed and random effects of time Significance

More information

ANOVA Longitudinal Models for the Practice Effects Data: via GLM

ANOVA Longitudinal Models for the Practice Effects Data: via GLM Psyc 943 Lecture 25 page 1 ANOVA Longitudinal Models for the Practice Effects Data: via GLM Model 1. Saturated Means Model for Session, E-only Variances Model (BP) Variances Model: NO correlation, EQUAL

More information

Introduction and Background to Multilevel Analysis

Introduction 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 information

Biostatistics Workshop Longitudinal Data Analysis. Session 4 GARRETT FITZMAURICE

Biostatistics Workshop Longitudinal Data Analysis. Session 4 GARRETT FITZMAURICE Biostatistics Workshop 2008 Longitudinal Data Analysis Session 4 GARRETT FITZMAURICE Harvard University 1 LINEAR MIXED EFFECTS MODELS Motivating Example: Influence of Menarche on Changes in Body Fat Prospective

More information

Covariance Structure Approach to Within-Cases

Covariance Structure Approach to Within-Cases Covariance Structure Approach to Within-Cases Remember how the data file grapefruit1.data looks: Store sales1 sales2 sales3 1 62.1 61.3 60.8 2 58.2 57.9 55.1 3 51.6 49.2 46.2 4 53.7 51.5 48.3 5 61.4 58.7

More information

Testing Indirect Effects for Lower Level Mediation Models in SAS PROC MIXED

Testing Indirect Effects for Lower Level Mediation Models in SAS PROC MIXED Testing Indirect Effects for Lower Level Mediation Models in SAS PROC MIXED Here we provide syntax for fitting the lower-level mediation model using the MIXED procedure in SAS as well as a sas macro, IndTest.sas

More information

Linear Mixed Models. One-way layout REML. Likelihood. Another perspective. Relationship to classical ideas. Drawbacks.

Linear Mixed Models. One-way layout REML. Likelihood. Another perspective. Relationship to classical ideas. Drawbacks. Linear Mixed Models One-way layout Y = Xβ + Zb + ɛ where X and Z are specified design matrices, β is a vector of fixed effect coefficients, b and ɛ are random, mean zero, Gaussian if needed. Usually think

More information

One-stage dose-response meta-analysis

One-stage dose-response meta-analysis One-stage dose-response meta-analysis Nicola Orsini, Alessio Crippa Biostatistics Team Department of Public Health Sciences Karolinska Institutet http://ki.se/en/phs/biostatistics-team 2017 Nordic and

More information

Variance component models part I

Variance component models part I Faculty of Health Sciences Variance component models part I Analysis of repeated measurements, 30th November 2012 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen

More information

MLMED. User Guide. Nicholas J. Rockwood The Ohio State University Beta Version May, 2017

MLMED. User Guide. Nicholas J. Rockwood The Ohio State University Beta Version May, 2017 MLMED User Guide Nicholas J. Rockwood The Ohio State University rockwood.19@osu.edu Beta Version May, 2017 MLmed is a computational macro for SPSS that simplifies the fitting of multilevel mediation and

More information

A brief introduction to mixed models

A 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 information

Introduction to Within-Person Analysis and RM ANOVA

Introduction 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 information

Mixed effects models

Mixed 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 information

17. Example SAS Commands for Analysis of a Classic Split-Plot Experiment 17. 1

17. 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 information

Lecture 4. Random Effects in Completely Randomized Design

Lecture 4. Random Effects in Completely Randomized Design Lecture 4. Random Effects in Completely Randomized Design Montgomery: 3.9, 13.1 and 13.7 1 Lecture 4 Page 1 Random Effects vs Fixed Effects Consider factor with numerous possible levels Want to draw inference

More information

lme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept

lme4 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 information

Hierarchical Generalized Linear Models. ERSH 8990 REMS Seminar on HLM Last Lecture!

Hierarchical Generalized Linear Models. ERSH 8990 REMS Seminar on HLM Last Lecture! Hierarchical Generalized Linear Models ERSH 8990 REMS Seminar on HLM Last Lecture! Hierarchical Generalized Linear Models Introduction to generalized models Models for binary outcomes Interpreting parameter

More information

Classification. Chapter Introduction. 6.2 The Bayes classifier

Classification. Chapter Introduction. 6.2 The Bayes classifier Chapter 6 Classification 6.1 Introduction Often encountered in applications is the situation where the response variable Y takes values in a finite set of labels. For example, the response Y could encode

More information

Lab 11. Multilevel Models. Description of Data

Lab 11. Multilevel Models. Description of Data Lab 11 Multilevel Models Henian Chen, M.D., Ph.D. Description of Data MULTILEVEL.TXT is clustered data for 386 women distributed across 40 groups. ID: 386 women, id from 1 to 386, individual level (level

More information

Random Effects. Edps/Psych/Stat 587. Carolyn J. Anderson. Fall Department of Educational Psychology. university of illinois at urbana-champaign

Random Effects. Edps/Psych/Stat 587. Carolyn J. Anderson. Fall Department of Educational Psychology. university of illinois at urbana-champaign Random Effects Edps/Psych/Stat 587 Carolyn J. Anderson Department of Educational Psychology I L L I N O I S university of illinois at urbana-champaign Fall 2012 Outline Introduction Empirical Bayes inference

More information

Answer to exercise: Blood pressure lowering drugs

Answer to exercise: Blood pressure lowering drugs Answer to exercise: Blood pressure lowering drugs The data set bloodpressure.txt contains data from a cross-over trial, involving three different formulations of a drug for lowering of blood pressure:

More information

Advanced Quantitative Data Analysis

Advanced Quantitative Data Analysis Chapter 24 Advanced Quantitative Data Analysis Daniel Muijs Doing Regression Analysis in SPSS When we want to do regression analysis in SPSS, we have to go through the following steps: 1 As usual, we choose

More information

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key Statistical Methods III Statistics 212 Problem Set 2 - Answer Key 1. (Analysis to be turned in and discussed on Tuesday, April 24th) The data for this problem are taken from long-term followup of 1423

More information

MISCELLANEOUS TOPICS RELATED TO LIKELIHOOD. Copyright c 2012 (Iowa State University) Statistics / 30

MISCELLANEOUS TOPICS RELATED TO LIKELIHOOD. Copyright c 2012 (Iowa State University) Statistics / 30 MISCELLANEOUS TOPICS RELATED TO LIKELIHOOD Copyright c 2012 (Iowa State University) Statistics 511 1 / 30 INFORMATION CRITERIA Akaike s Information criterion is given by AIC = 2l(ˆθ) + 2k, where l(ˆθ)

More information

Non-Gaussian Response Variables

Non-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 information

Generalized Linear Models

Generalized Linear Models Generalized Linear Models Lecture 3. Hypothesis testing. Goodness of Fit. Model diagnostics GLM (Spring, 2018) Lecture 3 1 / 34 Models Let M(X r ) be a model with design matrix X r (with r columns) r n

More information

Stat/F&W Ecol/Hort 572 Review Points Ané, Spring 2010

Stat/F&W Ecol/Hort 572 Review Points Ané, Spring 2010 1 Linear models Y = Xβ + ɛ with ɛ N (0, σ 2 e) or Y N (Xβ, σ 2 e) where the model matrix X contains the information on predictors and β includes all coefficients (intercept, slope(s) etc.). 1. Number of

More information

Topic 25 - One-Way Random Effects Models. Outline. Random Effects vs Fixed Effects. Data for One-way Random Effects Model. One-way Random effects

Topic 25 - One-Way Random Effects Models. Outline. Random Effects vs Fixed Effects. Data for One-way Random Effects Model. One-way Random effects Topic 5 - One-Way Random Effects Models One-way Random effects Outline Model Variance component estimation - Fall 013 Confidence intervals Topic 5 Random Effects vs Fixed Effects Consider factor with numerous

More information

Models for longitudinal data

Models for longitudinal data Faculty of Health Sciences Contents Models for longitudinal data Analysis of repeated measurements, NFA 016 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen

More information

WU Weiterbildung. Linear Mixed Models

WU Weiterbildung. Linear Mixed Models Linear Mixed Effects Models WU Weiterbildung SLIDE 1 Outline 1 Estimation: ML vs. REML 2 Special Models On Two Levels Mixed ANOVA Or Random ANOVA Random Intercept Model Random Coefficients Model Intercept-and-Slopes-as-Outcomes

More information

Generalized Linear. Mixed Models. Methods and Applications. Modern Concepts, Walter W. Stroup. Texts in Statistical Science.

Generalized Linear. Mixed Models. Methods and Applications. Modern Concepts, Walter W. Stroup. Texts in Statistical Science. Texts in Statistical Science Generalized Linear Mixed Models Modern Concepts, Methods and Applications Walter W. Stroup CRC Press Taylor & Francis Croup Boca Raton London New York CRC Press is an imprint

More information

Mixed models with correlated measurement errors

Mixed 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 information

You can specify the response in the form of a single variable or in the form of a ratio of two variables denoted events/trials.

You can specify the response in the form of a single variable or in the form of a ratio of two variables denoted events/trials. The GENMOD Procedure MODEL Statement MODEL response = < effects > < /options > ; MODEL events/trials = < effects > < /options > ; You can specify the response in the form of a single variable or in the

More information

Linear Regression Models P8111

Linear Regression Models P8111 Linear Regression Models P8111 Lecture 25 Jeff Goldsmith April 26, 2016 1 of 37 Today s Lecture Logistic regression / GLMs Model framework Interpretation Estimation 2 of 37 Linear regression Course started

More information

Statistics 203: Introduction to Regression and Analysis of Variance Course review

Statistics 203: Introduction to Regression and Analysis of Variance Course review Statistics 203: Introduction to Regression and Analysis of Variance Course review Jonathan Taylor - p. 1/?? Today Review / overview of what we learned. - p. 2/?? General themes in regression models Specifying

More information

ST3241 Categorical Data Analysis I Multicategory Logit Models. Logit Models For Nominal Responses

ST3241 Categorical Data Analysis I Multicategory Logit Models. Logit Models For Nominal Responses ST3241 Categorical Data Analysis I Multicategory Logit Models Logit Models For Nominal Responses 1 Models For Nominal Responses Y is nominal with J categories. Let {π 1,, π J } denote the response probabilities

More information

UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Applied Statistics Friday, January 15, 2016

UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Applied Statistics Friday, January 15, 2016 UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Applied Statistics Friday, January 15, 2016 Work all problems. 60 points are needed to pass at the Masters Level and 75 to pass at the

More information

Introduction to Random Effects of Time and Model Estimation

Introduction to Random Effects of Time and Model Estimation Introduction to Random Effects of Time and Model Estimation Today s Class: The Big Picture Multilevel model notation Fixed vs. random effects of time Random intercept vs. random slope models How MLM =

More information

ADVANCED STATISTICAL ANALYSIS OF EPIDEMIOLOGICAL STUDIES. Cox s regression analysis Time dependent explanatory variables

ADVANCED STATISTICAL ANALYSIS OF EPIDEMIOLOGICAL STUDIES. Cox s regression analysis Time dependent explanatory variables ADVANCED STATISTICAL ANALYSIS OF EPIDEMIOLOGICAL STUDIES Cox s regression analysis Time dependent explanatory variables Henrik Ravn Bandim Health Project, Statens Serum Institut 4 November 2011 1 / 53

More information

Introduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data

Introduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data Introduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data Bryan A. Comstock and Patrick J. Heagerty Department of Biostatistics University of Washington

More information

Model comparison and selection

Model comparison and selection BS2 Statistical Inference, Lectures 9 and 10, Hilary Term 2008 March 2, 2008 Hypothesis testing Consider two alternative models M 1 = {f (x; θ), θ Θ 1 } and M 2 = {f (x; θ), θ Θ 2 } for a sample (X = x)

More information

The consequences of misspecifying the random effects distribution when fitting generalized linear mixed models

The consequences of misspecifying the random effects distribution when fitting generalized linear mixed models The consequences of misspecifying the random effects distribution when fitting generalized linear mixed models John M. Neuhaus Charles E. McCulloch Division of Biostatistics University of California, San

More information

This is a Randomized Block Design (RBD) with a single factor treatment arrangement (2 levels) which are fixed.

This is a Randomized Block Design (RBD) with a single factor treatment arrangement (2 levels) which are fixed. EXST3201 Chapter 13c Geaghan Fall 2005: Page 1 Linear Models Y ij = µ + βi + τ j + βτij + εijk This is a Randomized Block Design (RBD) with a single factor treatment arrangement (2 levels) which are fixed.

More information

Topic 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. 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 information

Multilevel Methodology

Multilevel Methodology Multilevel Methodology Geert Molenberghs Interuniversity Institute for Biostatistics and statistical Bioinformatics Universiteit Hasselt, Belgium geert.molenberghs@uhasselt.be www.censtat.uhasselt.be Katholieke

More information

assumes a linear relationship between mean of Y and the X s with additive normal errors the errors are assumed to be a sample from N(0, σ 2 )

assumes a linear relationship between mean of Y and the X s with additive normal errors the errors are assumed to be a sample from N(0, σ 2 ) Multiple Linear Regression is used to relate a continuous response (or dependent) variable Y to several explanatory (or independent) (or predictor) variables X 1, X 2,, X k assumes a linear relationship

More information

STAT 5200 Handout #23. Repeated Measures Example (Ch. 16)

STAT 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 information

Multi-factor analysis of variance

Multi-factor analysis of variance Faculty of Health Sciences Outline Multi-factor analysis of variance Basic statistics for experimental researchers 2015 Two-way ANOVA and interaction Mathed samples ANOVA Random vs systematic variation

More information

Multinomial Logistic Regression Models

Multinomial Logistic Regression Models Stat 544, Lecture 19 1 Multinomial Logistic Regression Models Polytomous responses. Logistic regression can be extended to handle responses that are polytomous, i.e. taking r>2 categories. (Note: The word

More information

36-720: Linear Mixed Models

36-720: Linear Mixed Models 36-720: Linear Mixed Models Brian Junker October 8, 2007 Review: Linear Mixed Models (LMM s) Bayesian Analogues Facilities in R Computational Notes Predictors and Residuals Examples [Related to Christensen

More information

An R # Statistic for Fixed Effects in the Linear Mixed Model and Extension to the GLMM

An R # Statistic for Fixed Effects in the Linear Mixed Model and Extension to the GLMM An R Statistic for Fixed Effects in the Linear Mixed Model and Extension to the GLMM Lloyd J. Edwards, Ph.D. UNC-CH Department of Biostatistics email: Lloyd_Edwards@unc.edu Presented to the Department

More information

Analysis of variance and regression. May 13, 2008

Analysis of variance and regression. May 13, 2008 Analysis of variance and regression May 13, 2008 Repeated measurements over time Presentation of data Traditional ways of analysis Variance component model (the dogs revisited) Random regression Baseline

More information

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data Ronald Heck Class Notes: Week 8 1 Class Notes: Week 8 Probit versus Logit Link Functions and Count Data This week we ll take up a couple of issues. The first is working with a probit link function. While

More information

Stat 579: Generalized Linear Models and Extensions

Stat 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 information

Mixed 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 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 information

NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION (SOLUTIONS) ST3241 Categorical Data Analysis. (Semester II: )

NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION (SOLUTIONS) ST3241 Categorical Data Analysis. (Semester II: ) NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION (SOLUTIONS) Categorical Data Analysis (Semester II: 2010 2011) April/May, 2011 Time Allowed : 2 Hours Matriculation No: Seat No: Grade Table Question 1 2 3

More information

Generalized 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 / 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 information

Beyond GLM and likelihood

Beyond GLM and likelihood Stat 6620: Applied Linear Models Department of Statistics Western Michigan University Statistics curriculum Core knowledge (modeling and estimation) Math stat 1 (probability, distributions, convergence

More information

Ch 2: Simple Linear Regression

Ch 2: Simple Linear Regression Ch 2: Simple Linear Regression 1. Simple Linear Regression Model A simple regression model with a single regressor x is y = β 0 + β 1 x + ɛ, where we assume that the error ɛ is independent random component

More information

Outline. 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. 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 information

Lecture 2: Poisson and logistic regression

Lecture 2: Poisson and logistic regression Dankmar Böhning Southampton Statistical Sciences Research Institute University of Southampton, UK S 3 RI, 11-12 December 2014 introduction to Poisson regression application to the BELCAP study introduction

More information

13. October p. 1

13. 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 information

Mixed Models for Longitudinal Binary Outcomes. Don Hedeker Department of Public Health Sciences University of Chicago.

Mixed Models for Longitudinal Binary Outcomes. Don Hedeker Department of Public Health Sciences University of Chicago. Mixed Models for Longitudinal Binary Outcomes Don Hedeker Department of Public Health Sciences University of Chicago hedeker@uchicago.edu https://hedeker-sites.uchicago.edu/ Hedeker, D. (2005). Generalized

More information

Random and Mixed Effects Models - Part III

Random 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 information

Covariance Models (*) X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed effects

Covariance 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 information

Variance components and LMMs

Variance components and LMMs Faculty of Health Sciences Topics for today Variance components and LMMs Analysis of repeated measurements, 4th December 04 Leftover from 8/: Rest of random regression example. New concepts for today:

More information

Models for binary data

Models for binary data Faculty of Health Sciences Models for binary data Analysis of repeated measurements 2015 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen 1 / 63 Program for

More information

20. 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 / 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 information

Package HGLMMM for Hierarchical Generalized Linear Models

Package HGLMMM for Hierarchical Generalized Linear Models Package HGLMMM for Hierarchical Generalized Linear Models Marek Molas Emmanuel Lesaffre Erasmus MC Erasmus Universiteit - Rotterdam The Netherlands ERASMUSMC - Biostatistics 20-04-2010 1 / 52 Outline General

More information

Mixed Effects Models

Mixed 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 information

Variance components and LMMs

Variance components and LMMs Faculty of Health Sciences Variance components and LMMs Analysis of repeated measurements, 4th December 2014 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen

More information

Time-Invariant Predictors in Longitudinal Models

Time-Invariant Predictors in Longitudinal Models Time-Invariant Predictors in Longitudinal Models Today s Class (or 3): Summary of steps in building unconditional models for time What happens to missing predictors Effects of time-invariant predictors

More information

Mixed 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 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 information

STAT 526 Advanced Statistical Methodology

STAT 526 Advanced Statistical Methodology STAT 526 Advanced Statistical Methodology Fall 2017 Lecture Note 10 Analyzing Clustered/Repeated Categorical Data 0-0 Outline Clustered/Repeated Categorical Data Generalized Linear Mixed Models Generalized

More information

Mixed 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 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 information

Lecture 10: Experiments with Random Effects

Lecture 10: Experiments with Random Effects Lecture 10: Experiments with Random Effects Montgomery, Chapter 13 1 Lecture 10 Page 1 Example 1 A textile company weaves a fabric on a large number of looms. It would like the looms to be homogeneous

More information