120 likes | 448 Views
Using SAS Proc Mixed to fit the multilevel model for change. Time is nature’s way of keeping everything from happening at once Woody Allen. Judith D. Singer & John B. Willett Harvard Graduate School of Education. Resources to help you learn how to use SAS Proc Mixed.
E N D
Using SAS Proc Mixedto fit the multilevel model for change Time is nature’s way of keeping everything from happening at once Woody Allen Judith D. Singer & John B. Willett Harvard Graduate School of Education © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 1
Resources to help you learn how to use SAS Proc Mixed Textbook ExamplesApplied Longitudinal Data Analysis: Modeling Change and Event Occurrenceby Judith D. Singer and John B. Willett Mplus MLwiN HLM SAS Stata SPlus SPSS Chapter Datasets 1 1 1 1 1 1 1 Table of contents Ch 1 A framework for investigating change over time Ch 2 1 1 1 1 1 1 1 Exploring longitudinal data on change Ch 3 1 1 1 1 1 1 Introducing the multilevel model for change Ch 4 1 1 1 1 1 Doing data analysis with the multilevel model for change Ch 5 1 1 1 1 1 1 Treating time more flexibly Ch 6 1 1 1 1 1 1 Modeling discontinuous and nonlinear change Ch 7 1 1 1 1 1 Examining the multilevel model’s error covariance structure Ch 8 1 1 Modeling change using covariance structure analysis Ch 9 1 1 A framework for investigating event occurrence Ch 10 1 1 1 Describing discrete-time event occurrence data Ch 11 1 1 1 1 Fitting basic discrete-time hazard models Ch 12 1 1 1 Extending the discrete-time hazard model Ch 13 1 1 1 Describing continuous-time event occurrence data Ch 14 1 1 1 Fitting the Cox regression model Ch 15 1 1 1 Extending the Cox regression model What we’ll do now: Using the specific models we just fit in Chapter Four todemonstrate how to use SAS PROC MIXED to fit these models to data • Model A: The unconditional means model • Model B: The unconditional growth model • Model C: The uncontrolled effects of COA • Model D: The controlled effects of COA © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 2
Using SAS Proc Mixed to fit Model A (the unconditional means model) CompositeModel: Level-1 Model: Level-2 Model: • The class id statement tells SAS to treat the variable ID as a categorical (in SAS’ terms, a classification) variable. If you omit this statement, by default, SAS would treat ID as a continuous variable. • The proc mixed statement invokes the procedure, here using the dataset named “one.” • The method = ml option tells SAS to use full maximum likelihood estimation. If you omit this option, by default SAS uses restricted maximum likelihood (as discussed on Chapter 4, slide 27) • The covtest option tells SAS to display tests for the variance components. By default, SAS omits these tests (as discussed on Chapter 4, slide 23). proc mixed data=one method=ml covtest; class id; model alcuse = /solution; random intercept/subject=id; • The random statement specifies the stochastic portion of the multilevel model for change. By default, SAS always includes a variance component for the level-1 residuals. In this unconditional means model, the ‘random intercept’ option tells SAS to also include a variance component for the intercept (allowing the means to vary across people). • The /subject=id option tells SAS that the intercepts (the means in this unconditional means model) should be allowed to vary randomly across individuals (as identified by the classification variable ID) • The model statement specifies the structural portion of the multilevel model for change. This specification ‘model alcuse = ’ may seem unusual but it’s the way SAS represents the unconditional means model (see Chapter 4, slide 9). The model includes no explicit predictor, but like any regression model, includes an implicit intercept by default. • The /solution option on the model statement tells SAS to display the estimated fixed effects (as well as the associated standard errors and hypothesis tests). © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 3
Results of fitting Model A (the unconditional means model) to data CompositeModel: Level-1 Model: proc mixed data=one method=ml covtest; class id; model alcuse = /solution; random intercept/subject=id; Level-2 Model: Model A: Unconditional means model The Mixed Procedure Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z Intercept ID 0.5639 0.1191 4.73 <.0001 Residual 0.5617 0.06203 9.06 <.0001 Fit Statistics -2 Log Likelihood 670.2 AIC (smaller is better) 676.2 AICC (smaller is better) 676.3 BIC (smaller is better) 683.4 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 0.9220 0.09571 81 9.63 <.0001 © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 4
Using SAS Proc Mixed to fit Model B (the unconditional growth model) Level-1 Model: Level-2 Model: CompositeModel: • As before, SAS implicitly assumes a variance component for the level-1 residuals. But because Model B includes a second random effect to capture the hypothesized level-2 stochastic variation, the random statement must be modified to include this second term—denoted by the temporal predictor AGE_14. • The /type=un, which stands for unstructured, is crucial, telling SAS to not impose any structure on the variance covariance matrix for the level-2 residuals. proc mixed data=one method=ml covtest; class id; model alcuse = age_14/solution; random intercept age_14/type=un subject=id; • Model B, the unconditional growth model, includes a single predictor, age_14, representing the slope of the level-1 individual growth trajectory. As before, SAS implicitly understands that the user wishes to include an intercept term. Because the predictor age_14 is centered at age 14 (the first wave of data collection), the intercept now represents “initial status.” © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 5
Results of fitting Model B (the unconditional growth model) to data Parameter #1 Parameter #2 proc mixed data=one method=ml covtest; class id; model alcuse = age_14/solution; random intercept age_14/type=un subject=id; Model B: Unconditional growth model The Mixed Procedure Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z UN(1,1) ID 0.6244 0.1481 4.22 <.0001 UN(2,1) ID -0.06844 0.07008 -0.98 0.3288 UN(2,2) ID 0.1512 0.05647 2.68 0.0037 Residual 0.3373 0.05268 6.40 <.0001 Fit Statistics -2 Log Likelihood 636.6 AIC (smaller is better) 648.6 AICC (smaller is better) 649.0 BIC (smaller is better) 663.1 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 0.6513 0.1051 81 6.20 <.0001 AGE_14 0.2707 0.06245 81 4.33 <.0001 © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 6
Using SAS Proc Mixed to fit Model C (Uncontrolled effects of COA) Level-1 Model: Level-2 Model: CompositeModel: • Like the companion Level-2 model, Model C adds two terms to register the uncontrolled effects of COA: (1) a main effect of COA, which captures the effect on the intercept (initial status); and (2) the cross-level interaction, COA*AGE_14, which captures the effect of COA on the rate of change proc mixed data=one method=ml covtest; class id; model alcuse = coa age_14 coa*age_14/solution; random intercept age_14/type=un subject=id; • All other statements, including the random statement, are unchanged from Model B because we have only added new fixed effects (for COA) and not any new random effects. © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 7
Results of fitting Model C (the uncontrolled effects of COA) to data proc mixed data=one method=ml covtest; class id; model alcuse = coa age_14 coa*age_14/solution; random intercept age_14/type=un subject=id; Model C: Uncontrolled effects of COA The Mixed Procedure Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z UN(1,1) ID 0.4876 0.1278 3.81 <.0001 UN(2,1) ID -0.05934 0.06573 -0.90 0.3666 UN(2,2) ID 0.1506 0.05639 2.67 0.0038 Residual 0.3373 0.05268 6.40 <.0001 Fit Statistics -2 Log Likelihood 621.2 AIC (smaller is better) 637.2 AICC (smaller is better) 637.8 BIC (smaller is better) 656.5 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 0.3160 0.1307 80 2.42 0.0179 COA 0.7432 0.1946 82 3.82 0.0003 AGE_14 0.2930 0.08423 80 3.48 0.0008 COA*AGE_14 -0.04943 0.1254 82 -0.39 0.6944 © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 8
Using SAS Proc Mixed to fit Model D (Controlled effects of COA) Level-1 Model: Level-2 Model: CompositeModel: • Like the companion Level-2 model, Model D adds two terms to register the controlled effects of PEER: (1) a main effect of PEER, which captures the effect on the intercept (initial status); and (2) the cross-level interaction, PEER*AGE_14, which captures the effect of PEER on the rate of change proc mixed data=one method=ml covtest; class id; model alcuse = coa peer age_14 coa*age_14 peer*age_14/solution; random intercept age_14/type=un subject=id; • All other statements, including the random statement, are unchanged from Model C because we have only added new fixed effects (for PEER) and not any new random effects. © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 9
Results of fitting Model D (the controlled effects of COA) to data Model D: Controlled effects of COA The Mixed Procedure Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z UN(1,1) ID 0.2409 0.09259 2.60 0.0046 UN(2,1) ID -0.00612 0.05500 -0.11 0.9115 UN(2,2) ID 0.1391 0.05481 2.54 0.0056 Residual 0.3373 0.05268 6.40 <.0001 Fit Statistics -2 Log Likelihood 588.7 AIC (smaller is better) 608.7 AICC (smaller is better) 609.6 BIC (smaller is better) 632.8 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept -0.3165 0.1481 79 -2.14 0.0356 COA 0.5792 0.1625 82 3.56 0.0006 PEER 0.6943 0.1115 82 6.23 <.0001 AGE_14 0.4294 0.1137 79 3.78 0.0003 COA*AGE_14 -0.01403 0.1248 82 -0.11 0.9107 PEER*AGE_14 -0.1498 0.08564 82 -1.75 0.0840 Go to resources to help you use SAS © Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 10
© Judith D. Singer & John B. Willett, Harvard Graduate School of Education, Using SAS Proc Mixed, slide 11