In this chapter we will be using the following centered variables: GndC_verb is iq_verb centered around the grand mean; GrpMC_verb contains the group means of GndC_verb; GndC_ses is ses centered around the grand mean.
Furthermore, we will be creating the following variables: IQ_tilda which is equal to GndC_verb – GrpMC_verb.
We are using the schools3 data set from chapter 5 containing the centered variables mentioned in the first paragraph. The following is code is for creating schools3 from the mlbook1 dataset.
data schools; set 'c:sasmlbook1'; run; *centering verb_iq around grand mean. ; proc sql; create table schools1 as select *, iq_verb - mean(iq_verb) as GndC_verb from schools; quit; *Creating GrpMC_verb contains group means of GndC_iq. ; proc sql; create table schools2 as select *, mean(GndC_verb) as GrpMC_verb from schools1 group by schoolnr; quit; *Creating the variable GndC_ses equal to ses centered around its grand mean.; proc sql; create table schools3 as select *, ses - mean(ses) as GndC_ses from schools2; quit;
Creating the within-group deviation variable IQ_tilda, p. 87.
data schools3; set schools3; IQ_tilda = GndC_verb - GrpMC_verb; run;
Table 6.1, model 1, p. 87.
proc mixed data=schools3 noitprint noclprint covtest; model langpost = GndC_verb GndC_ses GrpMC_verb / solution; random intercept GndC_verb / subject=schoolnr type=un; run; <output omitted> Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z UN(1,1) schoolNR 8.3497 1.3742 6.08 <.0001 UN(2,1) schoolNR -0.7314 0.2862 -2.56 0.0106 UN(2,2) schoolNR 0.1765 0.09321 1.89 0.0291 Residual 39.3137 1.2253 32.08 <.0001 Fit Statistics -2 Res Log Likelihood 15114.7 AIC (smaller is better) 15122.7 AICC (smaller is better) 15122.7 BIC (smaller is better) 15134.2 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 40.7803 0.2901 129 140.55 <.0001 GndC_verb 2.2498 0.08274 130 27.19 <.0001 GndC_ses 0.1560 0.01468 2024 10.62 <.0001 GrpMC_verb 1.0866 0.3269 2024 3.32 0.0009
Table 6.1, model 2, p. 87.
proc mixed data=schools3 noitprint noclprint covtest; model langpost = IQ_tilda GndC_ses GrpMC_verb / solution; random intercept GndC_verb / subject=schoolnr type=un; run; <output omitted> Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z UN(1,1) schoolNR 8.3497 1.3742 6.08 <.0001 UN(2,1) schoolNR -0.7314 0.2862 -2.56 0.0106 UN(2,2) schoolNR 0.1765 0.09321 1.89 0.0291 Residual 39.3137 1.2253 32.08 <.0001 Fit Statistics -2 Res Log Likelihood 15114.7 AIC (smaller is better) 15122.7 AICC (smaller is better) 15122.7 BIC (smaller is better) 15134.2 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 40.7803 0.2901 129 140.55 <.0001 IQ_tilda 2.2498 0.08274 2024 27.19 <.0001 GndC_ses 0.1560 0.01468 2024 10.62 <.0001 GrpMC_verb 3.3365 0.3226 2024 10.34 <.0001
Example 6.2, testing a random slope, p. 89.
data temp; test_stat = abs(15251.8 - 15477.7); p_value = 1 - probchi(test_stat, 1); run; proc print data=temp noobs; run; test_ stat p_value 225.9 0
Example 6.3, testing the effect of a categorical variable, p. 89.
data temp1; test_stat = abs(15208.4 - 15193.6); p_value = 1 - probchi(test_stat, 3); run; proc print data=temp1 noobs; run; test_ stat p_value 14.8 .00199579
Example 6.4, testing a random slope, p. 91.
data temp2; test_stat = abs(15227.5 - 15213.5); p_value = 1 - probchi(test_stat, 2); run; proc print data=temp2 noobs; run; test_ stat p_value 14 .000911882