From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] on behalf of Automatic digest processor [LISTSERV@LISTSERV.UGA.EDU] Sent: Tuesday, November 01, 2005 3:17 PM To: Recipients of SAS-L digests Subject: SAS-L Digest - 1 Nov 2005 - Special issue (#2005-1570) ------------------------------ Date: Tue, 1 Nov 2005 13:13:42 -0500 From: XXX Subject: Re: FW: [SAS us6299825] PROC MIXED: specifying class variable changes intercept A very serendipitous posting as I am just completing some analyses in PROC MIXED and had created dummy variable columns for all the categorical variables I was evaluating, rather than using a CLASS statement. I foolishly, did not think to compare output. I had chosen not to use a CLASS statement because the fixed effects estimates output table is simplier (standard format across all models with different fixed effect parameterizations) and facilitated writing a simple macro to model average fixed effects estimates (the analysis I am working on takes a information- theoretic approach fitting multiple models and averaging parameter estimates weighted by the AICc model weight of the model they were estimated with). But now back to square one to rerun everything and attempt to write a new macro to model average. Still better than passing along misinterpreted results, since I had thought the estimates for my dummy variables represented differences in intercepts and not slopes. Thanks for the posting. DJR On Tue, 1 Nov 2005 10:39:01 -0600, wrote: >SAS Tech Support came through with a really nice explanation for how >specifying dummy variables in the CLASS statement changes results in a >GLM model (or MIXED), thought I would share. Bill H. > > >-----Original Message----- >From: SAS Technical Support [mailto:support@sas.com] >Sent: Tuesday, October 25, 2005 12:30 PM >To: XXX >Subject: [SAS us6299825] PROC MIXED: specifying class variable changes >intercept > ><=== Page: 1 === SAS Consultant === emailed w/answer === 25Oct2005 >12:24:44 ===> > >Bill, > >When you change the parameterization of the X matrix for your model, >that will change the interpretation of the f-statistics and of the >parameter estimates in your model. The overall models are comparable, >but the tests you get are different. > >Let's look at a simpler verion. The issue here is not with the RANDOM >and REPEATED statements. The issue concerns only the CLASS and MODEL >statements. > >The DATA step here > >data test; > do a=0 to 1; > do rep=1 to 10; > x=rannor(123); > y=3 + a + x + rannor(123); > output; > end; > end; >run; > >proc print data=test; >run; > >simulates data for a simple ANOVA model with a covariate. Effect A >takes on two levels (0 and 1) and X is a covariate in the model. > >You can approach the model in two ways. We recommend using the CLASS >statement since its use makes the tests and parameter estimates more >useful. The two models are > >proc mixed data=test; > class a; > model y=a x a*x / s; >run; > >proc mixed data=test; > model y=a x a*x/ s; >run; > >In the first model, you get > >Solution for Fixed Effects > > Standard >Effect a Estimate Error DF t Value Pr > |t| > >Intercept 3.5448 0.4011 16 8.84 <.0001 >a 0 -0.7768 0.5660 16 -1.37 0.1888 >a 1 0 . . . . >x 1.6497 0.6911 16 2.39 0.0297 >x*a 0 -0.9564 0.8717 16 -1.10 0.2888 >x*a 1 0 . . . . > > > Type 3 Tests of Fixed Effects > > Num Den >Effect DF DF F Value Pr > F > >a 1 16 1.88 0.1888 >x 1 16 7.22 0.0162 >x*a 1 16 1.20 0.2888 > > >The second model gives > > Solution for Fixed Effects > > Standard >Effect Estimate Error DF t Value Pr > |t| > >Intercept 2.7680 0.3994 16 6.93 <.0001 >a 0.7768 0.5660 16 1.37 0.1888 >x 0.6933 0.5313 16 1.30 0.2104 >a*x 0.9564 0.8717 16 1.10 0.2888 > > > Type 3 Tests of Fixed Effects > > Num Den >Effect DF DF F Value Pr > F > >a 1 16 1.88 0.1888 >x 1 16 1.70 0.2104 >a*x 1 16 1.20 0.2888 > > >You will notice the same kinds of differences in these two models >results as in your models results. > >The f-tests on both A and A*X are the same in both models. The test on >X is different though. >The parameter estimates are different in these models as well, though >by examining them you can tell how they are related. > >In the first model with the CLASS statement, the parameter estimate for >the intercept is actually the intercept for the 2nd level of the A >effect. The parameter estimate for the 1st level of A is the >difference in the intercepts for the 2 levels of the A effect. So the >estimate for the first level of A is 3.5448 - .7768 = 2.7680. The 2nd >model gives this value as the value of the intercept. Without A on the >CLASS statement, the parameter estimate of the model intercept is the >intercept for the first level of A. The parameter estimate for A >itself is the slope on A. Since A is 0,1 then the parameter estimate >for the "intercept" on the 2nd level of A is 2.7680 + 1*.7768 = 3.5448, >which is the same as from the first model. > >You can interpet the slopes on X in a similar fashion. > >Getting back to the f-tests, you can add the /E3 option to see the >hypothesis tested in each model. In the model with the CLASS >statement, the hypothesis on X is that the average slope across the two >levels of A is different from 0. The test in the 2nd model is that the >slope on X for the first level of A is different from 0. > >Changing the parameterization of the design matrix for the fixed >effects changes the interpretation of all of these statistics. > End of SAS-L Digest - 1 Nov 2005 - Special issue (#2005-1570) *************************************************************