## Apex Enterprises Example,revisited

### Confidence Intervals for Effects and Variance Components

#### Program Listing

```DATA apex (DROP=rep);
DO rep = 1 TO 4;
DO officer = 'A','B','C','D','E';
INPUT rating @@;
OUTPUT;
END;
END;
DATALINES;
76 59 49 74 66 65 75 63 71 84
85 81 61 85 80 74 67 46 89 79
;

OPTIONS LS=76 NONUMBER NOCENTER NODATE;

TITLE1 'One-Way Random-Effect Model';
TITLE2 'Apex Enterprises Data';
PROC MIXED DATA=apex
RATIO
ASYCOV   /* ASYmptotic COVariance matrix of estimates */
CL       /* Confidence Limits of above estimates */
COVTEST  /* asymptotic std.err and Wald's Z for COVariance TESTs */
ALPHA=0.1;  * use alpha=0.1 (default is 0.05);
CLASS officer;
MODEL rating = / CL ALPHA=0.1;  * Confidence Limits for fixed effect
(= grand mean) @ alpha=0.1;
RANDOM officer / CL;  * Confidence Limits of random effects;
RUN;

/* Note: calculation below uses textbook notation (SAS uses this) --
F(1-a; df1, df2) in which 1-a specifies lower-tail
probability, which is equivalent to classnotes
notation Fa; df1, df2 (in which, a
specifies upper-tail probability) */

TITLE3 'Confidence Intervals';
DATA _NULL_;
FILE PRINT;
MSB = 394.9250;   MSE = 73.2833;  F0 = MSB / MSE;
k = 5;   n = 4;   df1 = k - 1;   df2 = k * (n-1);
SSE = df2 * MSE;
alpha = 0.1;   a2 = alpha / 2;
F5 = QUANTILE('F', 1-a2, df1, df2);
F6 = QUANTILE('F', 1-a2, df2, df1);
L_lwr = (F0/F5 - 1) / n;   L_upr = (F0*F6 - 1) / n;
PUT 'Confidence Interval for Between/Within: '
L_lwr F6.4 ' to ' L_upr F6.4 //;
w1 = 1 / (1 + L_upr);   w2 = 1 / (1 + L_lwr);
PUT 'Confidence Interval for Within/Total: '
w1 F6.4 ' to ' w2 F6.4 //;
b1 = L_lwr / w2;   b2 = L_upr / w1;
PUT 'Confidence Interval for Between/Total: '
b1 F6.4 ' to ' b2 F6.4 //;
d1 = SSE / QUANTILE('CHISQUARE', 1-a2, df2);
d2 = SSE / QUANTILE('CHISQUARE', a2, df2);
PUT 'Confidence Interval for Within: '
d1 F6.4 ' to ' d2 F6.4 //;
PUT 'Confidence Interval for Between' /;
PUT '  ==> Satterthwaite Approach <==' /;
su2 = (MSB - MSE) / n;
df_S = (n * su2)**2 / (MSB**2/df1 + MSE**2/df2);
PUT 'Between is ' su2 F6.2 ' with ' df_S F4.2 ' degrees of freedom' //;
e1 = df1*su2 / QUANTILE('CHISQUARE', 1-a2, ROUND(df_S,1));
e2 = df1*su2 / QUANTILE('CHISQUARE', a2, ROUND(df_S,1));
PUT 'Confidence interval is:' e1 F6.2 ' to ' e2 F6.2 //;
PUT '  ==> Modified Large Sample Approach <==' /;
c1 = 1 / n;   c2 = - c1;
F1 = QUANTILE('CHISQUARE', 1-a2, df1) / df1;
F2 = QUANTILE('CHISQUARE', 1-a2, df2) / df2;
F3 = df1 / QUANTILE('CHISQUARE', a2, df1);
F4 = df2 / QUANTILE('CHISQUARE', a2, df2);
PUT F1= F4.2 F2= F4.2 F3= F4.2 F4= F4.2 F5= F4.2 F6= F4.2 /;
G1 = 1 - 1/F1;   G2 = 1 - 1/F2;
G3 = ((F5-1)**2 - (G1*F5)**2 - (F4-1)**2) / F5;
G4 = F6 * (((F6-1)/F6)**2 - ((F3-1)/F6)**2 -G2**2);
PUT G1= F4.2 G2= F4.2 G3= F4.2 G4= F4.2 /;
m1 = c1 * MSB;   m2 = c2 * MSE;   m3 = c1 * c2 * MSB * MSE;
H_lwr = SQRT((G1 * m1)**2 + ((F4-1) * m2)**2 - G3 * m3);
H_upr = SQRT(((F3-1) * m1)**2 + (G2 * m2)**2 - G4 * m3);
PUT H_lwr= F6.2 H_upr= F6.2 /;
u1 = su2 - H_lwr;   u2 = su2 + H_upr;
PUT 'Confidence interval is: ' u1 F6.2 ' to ' u2 F6.2 /;
RUN;
```

#### Output Listing

```One-Way Random-Effect Model
Apex Enterprises Data

The Mixed Procedure

Model Information
Data Set                     WORK.APEX
Dependent Variable           rating
Covariance Structure         Variance Components
Estimation Method            REML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Containment

Class Level Information
Class      Levels    Values
officer         5    A B C D E

Dimensions
Covariance Parameters             2
Columns in X                      1
Columns in Z                      5
Subjects                          1
Max Obs Per Subject              20

Number of Observations
Number of Observations Used              20
Number of Observations Not Used           0

Iteration History

Iteration    Evaluations    -2 Res Log Like       Criterion
0              1       150.94147984
1              1       145.24517813      0.00000000

Convergence criteria met.

Covariance Parameter Estimates
Standard       Z
Cov Parm   Ratio  Estimate     Error   Value     Pr Z  Alpha     Lower
officer   1.0973   80.4104   70.1333    1.15   0.1258    0.1   29.5215
Residual  1.0000   73.2833   26.7593    2.74   0.0031    0.1   43.9774

One-Way Random-Effect Model
Apex Enterprises Data

The Mixed Procedure

Covariance
Parameter Estimates
Cov Parm      Upper
officer      865.42
Residual     151.39

Asymptotic Covariance Matrix of Estimates
Row    Cov Parm        CovP1       CovP2
1    officer       4918.68     -179.01
2    Residual      -179.01      716.06

Fit Statistics
-2 Res Log Likelihood           145.2
AIC (smaller is better)         149.2
AICC (smaller is better)        150.0
BIC (smaller is better)         148.5

Solution for Fixed Effects
Standard
Effect     Estimate     Error    DF    t Value    Pr > |t|   Alpha
Intercept   71.4500    4.4437     4      16.08      <.0001     0.1

Solution for Fixed Effects
Effect          Lower       Upper
Intercept     61.9768     80.9232

Solution for Random Effects
Std Err
Effect    officer   Estimate     Pred   DF  t Value  Pr > |t|   Alpha
officer   A           2.8913   5.2933   15     0.55    0.5930    0.05
officer   B          -0.7737   5.2933   15    -0.15    0.8857    0.05

Solution for Random Effects
Effect    officer      Lower       Upper
officer   A          -8.3911     14.1737
officer   B         -12.0561     10.5087

One-Way Random-Effect Model
Apex Enterprises Data

The Mixed Procedure

Solution for Random Effects
Std Err
Effect    officer   Estimate     Pred   DF  t Value   Pr > |t|   Alpha
officer   C         -13.6011   5.2933   15    -2.57     0.0214    0.05
officer   D           6.7598   5.2933   15     1.28     0.2210    0.05
officer   E           4.7237   5.2933   15     0.89     0.3863    0.05

Solution for Random Effects
Effect    officer      Lower       Upper
officer   C         -24.8835     -2.3187
officer   D          -4.5226     18.0422
officer   E          -6.5587     16.0061

One-Way Random-Effect Model
Apex Enterprises Data
Confidence Intervals
Confidence Interval for Between/Within: 0.1909 to 7.6420

Confidence Interval for Within/Total: 0.1157 to 0.8397

Confidence Interval for Between/Total: 0.2274 to 66.041

Confidence Interval for Within: 43.977 to 151.39

Confidence Interval for Between

==> Satterthwaite Approach <==

Between is  80.41 with 2.63 degrees of freedom

Confidence interval is: 41.16 to 914.15

==> Modified Large Sample Approach <==

F1=2.37 F2=1.67 F3=5.63 F4=2.07 F5=3.06 F6=5.86

G1=0.58 G2=0.40 G3=-.01 G4=-.56

H_lwr=60.18 H_upr=455.87

Confidence interval is:  20.23 to 536.29
```