Data from Table 19.4, page 439 in a narrow format.
data table19_4; input s a b seeds; datalines; 1 1 1 13 1 1 2 14 1 1 3 17 1 1 4 20 2 1 1 10 2 1 2 11 2 1 3 15 2 1 4 14 3 1 1 13 3 1 2 19 3 1 3 18 3 1 4 22 4 1 1 4 4 1 2 12 4 1 3 14 4 1 4 16 5 2 1 5 5 2 2 13 5 2 3 21 5 2 4 24 6 2 1 8 6 2 2 18 6 2 3 25 6 2 4 27 7 2 1 14 7 2 2 19 7 2 3 26 7 2 4 26 8 2 1 12 8 2 2 24 8 2 3 29 8 2 4 29 9 3 1 13 9 3 2 24 9 3 3 28 9 3 4 32 10 3 1 9 10 3 2 22 10 3 3 22 10 3 4 24 11 3 1 14 11 3 2 22 11 3 3 28 11 3 4 28 12 3 1 8 12 3 2 18 12 3 3 27 12 3 4 29 ; run;
Data from Table 19.4, page 439 in a wide format.
data table19_4w; input s a b1 b2 b3 b4; datalines; 1 1 13 14 17 20 2 1 10 11 15 14 3 1 13 19 18 22 4 1 4 12 14 16 5 2 5 13 21 24 6 2 8 18 25 27 7 2 14 19 26 26 8 2 12 24 29 29 9 3 13 24 28 32 10 3 9 22 22 24 11 3 14 22 28 28 12 3 8 18 27 29 ; run;
Table 20.3, page 453. The simple effect of lesion type (Factor A) at level b4 using long data file.
proc glm data = table19_4; where b=4; class a; model seeds = a / ss3; run; quit;
The GLM Procedure
Class Level Information
Class Levels Values
a 3 1 2 3
Number of observations 12
Dependent Variable: seeds
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 2 240.5000000 120.2500000 12.62 0.0024
Error 9 85.7500000 9.5277778
Corrected Total 11 326.2500000
R-Square Coeff Var Root MSE seeds Mean
0.737165 12.72870 3.086710 24.25000
Source DF Type III SS Mean Square F Value Pr > F
a 2 240.5000000 120.2500000 12.62 0.0024
The same analysis using proc glm with a wide data file.
proc glm data = table19_4w; class a; model b4 = a / ss3; run; quit;
The GLM Procedure
Class Level Information
Class Levels Values
a 3 1 2 3
Number of observations 12
Dependent Variable: seeds
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 2 240.5000000 120.2500000 12.62 0.0024
Error 9 85.7500000 9.5277778
Corrected Total 11 326.2500000
R-Square Coeff Var Root MSE seeds Mean
0.737165 12.72870 3.086710 24.25000
Source DF Type III SS Mean Square F Value Pr > F
a 2 240.5000000 120.2500000 12.62 0.0024
The same analysis using proc mixed with a narrow data file
proc mixed data = table19_4; where b=4; class s a; model seeds = a; repeated / subject = s type = cs; run; quit;
The Mixed Procedure
Model Information
Data Set WORK.TABLE19_4
Dependent Variable seeds
Covariance Structure Compound Symmetry
Subject Effect s
Estimation Method REML
Residual Variance Method Profile
Fixed Effects SE Method Model-Based
Degrees of Freedom Method Between-Within
Class Level Information
Class Levels Values
s 12 1 2 3 4 5 6 7 8 9 10 11 12
a 3 1 2 3
Dimensions
Covariance Parameters 2
Columns in X 4
Columns in Z 0
Subjects 12
Max Obs Per Subject 1
Observations Used 12
Observations Not Used 0
Total Observations 12
Iteration History
Iteration Evaluations -2 Res Log Like Criterion
0 1 49.98768026
1 1 49.98768026 0.00000000
Convergence criteria met but final hessian is not positive
definite.
Covariance Parameter Estimates
Cov Parm Subject Estimate
CS s 8.6228
Residual 0.9050
Fit Statistics
-2 Res Log Likelihood 50.0
AIC (smaller is better) 54.0
AICC (smaller is better) 56.0
BIC (smaller is better) 55.0
Null Model Likelihood Ratio Test
DF Chi-Square Pr > ChiSq
1 0.00 1.0000
Type 3 Tests of Fixed Effects
Num Den
Effect DF DF F Value Pr > F
a 2 9 12.62 0.0024
Table 20.5, page 457. The analysis of a simple effect (Factor B) at group a1.
Using proc glm with a long data file.
proc glm data = table19_4; where a=1; class b s; model seeds = b|s /ss3; test h = b e = b*s; run; quit;
The GLM Procedure
Class Level Information
Class Levels Values
b 4 1 2 3 4
s 4 1 2 3 4
Number of observations 16
Dependent Variable: seeds
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 15 282.0000000 18.8000000 . .
Error 0 0.0000000 .
Corrected Total 15 282.0000000
R-Square Coeff Var Root MSE seeds Mean
1.000000 . . 14.50000
Source DF Type III SS Mean Square F Value Pr > F
b 3 140.0000000 46.6666667 . .
s 3 110.0000000 36.6666667 . .
b*s 9 32.0000000 3.5555556 . .
Tests of Hypotheses Using the Type III MS for b*s as an Error Term
Source DF Type III SS Mean Square F Value Pr > F
b 3 140.0000000 46.6666667 13.13 0.0012
The same analysis using proc glm with a wide data file.
proc glm data = table19_4w; where a = 1; model b1 b2 b3 b4 = / ss3; repeated b 4; run; quit;
[univariate output omitted]
The GLM Procedure
Repeated Measures Analysis of Variance
Repeated Measures Level Information
Dependent Variable b1 b2 b3 b4
Level of b 1 2 3 4
Manova Test Criteria and Exact F Statistics for the Hypothesis of no b Effect
H = Type III SSCP Matrix for b
E = Error SSCP Matrix
S=1 M=0.5 N=-0.5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.04597701 6.92 3 1 0.2709
Pillai's Trace 0.95402299 6.92 3 1 0.2709
Hotelling-Lawley Trace 20.75000000 6.92 3 1 0.2709
Roy's Greatest Root 20.75000000 6.92 3 1 0.2709
Univariate Tests of Hypotheses for Within Subject Effects
Adj Pr > F
Source DF Type III SS Mean Square F Value Pr > F G - G H - F
b 3 140.0000000 46.6666667 13.12 0.0012 0.0095 0.0012
Error(b) 9 32.0000000 3.5555556
Greenhouse-Geisser Epsilon 0.5905
Huynh-Feldt Epsilon 1.3803
The same analysis using proc mixed on a long data file.
proc mixed data = table19_4; where a=1; class b s; model seeds = b; repeated b / subject = s type = cs; run; quit;
The Mixed Procedure
Model Information
Data Set WORK.TABLE19_4
Dependent Variable seeds
Covariance Structure Compound Symmetry
Subject Effect s
Estimation Method REML
Residual Variance Method Profile
Fixed Effects SE Method Model-Based
Degrees of Freedom Method Between-Within
Class Level Information
Class Levels Values
b 4 1 2 3 4
s 4 1 2 3 4
Dimensions
Covariance Parameters 2
Columns in X 5
Columns in Z 0
Subjects 4
Max Obs Per Subject 4
Number of Observations
Number of Observations Read 16
Number of Observations Used 16
Number of Observations Not Used 0
Iteration History
Iteration Evaluations -2 Res Log Like Criterion
0 1 69.25074714
1 1 61.82190840 0.00000000
Convergence criteria met.
The Mixed Procedure
Covariance Parameter Estimates
Cov Parm Subject Estimate
CS s 8.2778
Residual 3.5556
Fit Statistics
-2 Res Log Likelihood 61.8
AIC (smaller is better) 65.8
AICC (smaller is better) 67.2
BIC (smaller is better) 64.6
Null Model Likelihood Ratio Test
DF Chi-Square Pr > ChiSq
1 7.43 0.0064
Type 3 Tests of Fixed Effects
Num Den
Effect DF DF F Value Pr > F
b 3 9 13.13 0.0012
Simple comparison of a within-subject factor in a mixed design, bottom of page 457.
Using proc glm with a long data file.
data table19_4; set table19_4; c = 0; if b = 1 then c = -1; if b = 4 then c = 1; run; proc glm data = table19_4; where a = 1; class s; model seeds = s|c / ss3; test h=c e=c*s; run; quit;
Class Level Information
Class Levels Values
s 4 1 2 3 4
Number of observations 16
Dependent Variable: seeds
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 7 255.0000000 36.4285714 10.79 0.0016
Error 8 27.0000000 3.3750000
Corrected Total 15 282.0000000
R-Square Coeff Var Root MSE seeds Mean
0.904255 12.66977 1.837117 14.50000
Source DF Type III SS Mean Square F Value Pr > F
s 3 110.0000000 36.6666667 10.86 0.0034
c 1 128.0000000 128.0000000 37.93 0.0003
c*s 3 17.0000000 5.6666667 1.68 0.2478
Tests of Hypotheses Using the Type III MS for c*s as an Error Term
Source DF Type III SS Mean Square F Value Pr > F
c 1 128.0000000 128.0000000 22.59 0.0177
The same analysis using proc glm with a wide data file.
proc glm data = table19_4w; where a = 1; model b1 b2 b3 b4 = ; repeated b 4; manova h = _ALL_ m = (-1 0 0 1); run; quit;
[output omitted]
The GLM Procedure
Multivariate Analysis of Variance
Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SSCP Matrix for Intercept
E = Error SSCP Matrix
Variables have been transformed by the M Matrix
Characteristic Characteristic Vector V'EV=1
Root Percent MVAR1
7.52941176 100.00 0.17149859
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of No Overall Intercept Effect
on the Variables Defined by the M Matrix Transformation
H = Type III SSCP Matrix for Intercept
E = Error SSCP Matrix
S=1 M=-0.5 N=0.5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.11724138 22.59 1 3 0.0177
Pillai's Trace 0.88275862 22.59 1 3 0.0177
Hotelling-Lawley Trace 7.52941176 22.59 1 3 0.0177
Roy's Greatest Root 7.52941176 22.59 1 3 0.0177
Using proc mixed on a narrow data file
proc mixed data = table19_4; where (a=1) & (b=1 or b=4); class b s; model seeds = b; repeated b / subject = s type = cs; run; quit;
Model Information
Data Set WORK.TABLE19_4
Dependent Variable seeds
Covariance Structure Compound Symmetry
Subject Effect s
Estimation Method REML
Residual Variance Method Profile
Fixed Effects SE Method Model-Based
Degrees of Freedom Method Between-Within
Class Level Information
Class Levels Values
b 2 1 4
s 4 1 2 3 4
Dimensions
Covariance Parameters 2
Columns in X 3
Columns in Z 0
Subjects 4
Max Obs Per Subject 2
Number of Observations
Number of Observations Read 8
Number of Observations Used 8
Number of Observations Not Used 0
Iteration History
Iteration Evaluations -2 Res Log Like Criterion
0 1 36.30906300
1 1 34.73923369 0.00000000
Convergence criteria met.
Covariance Parameter Estimates
Cov Parm Subject Estimate
CS s 10.0000
Residual 5.6667
Fit Statistics
-2 Res Log Likelihood 34.7
AIC (smaller is better) 38.7
AICC (smaller is better) 42.7
BIC (smaller is better) 37.5
Null Model Likelihood Ratio Test
DF Chi-Square Pr > ChiSq
1 1.57 0.2102
Type 3 Tests of Fixed Effects
Num Den
Effect DF DF F Value Pr > F
b 1 3 22.59 0.0177
Top of page 458, re-running above analysis assuming homogeneity of covariance, a more powerful test.
This would appear to need to be computed by hand
Top of page 459, Analysis of ΨAXB Interaction Compenent
Using proc glm on the wide data file.
* c1 is the contrast of interest, c2 is just a throw in; data table19_4wa; set table19_4w; if a=1 then c1 = 1; if a=2 then c1 = -.5; if a=3 then c1 = -.5; if a=1 then c2 = 0; if a=2 then c2 = 1; if a=3 then c2 = -1; run;
* note c1 and c2 take the place of a, and they are NOT in a class statement; proc glm data = table19_4wa; model b1 b2 b3 b4 = c1 c2; repeated b 4; run; quit;
[much output omitted]
The GLM Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects
Adj Pr > F
Source DF Type III SS Mean Square F Value Pr > F G - G H - F
b 3 1405.500000 468.500000 127.77 <.0001 <.0001 <.0001
b*c1 3 150.750000 50.250000 13.70 <.0001 <.0001 <.0001
b*c2 3 4.750000 1.583333 0.43 0.7319 0.6879 0.7319
Error(b) 27 99.000000 3.666667
Greenhouse-Geisser Epsilon 0.7903
Huynh-Feldt Epsilon 1.3301
