MTB > read 'a:\351\brogkut.dat' c1-c4
Entering data from file: a:\351\brogkut.dat
     42 rows read.
MTB > name c1 'method'
MTB > name c2 'prepost'
MTB > name c3 'outcome'
MTB > name c4 'subject'
MTB > info

Column   Name          Count
C1       method           42
C2       prepost          42
C3       outcome          42
C4       subject          42

REPEATED MEASURES ANALYSIS

MTB > glm outcome = subject(method) + method|prepost;
SUBC> random subject;
SUBC> ems;
SUBC> means method|prepost.

General Linear Model


Factor            Type Levels Values
subject(method) random     21  1  2  3  4  5  6  7  8  1  2  3  4  5  6  7  8
                               9 10 11 12 13
method           fixed      2 1 2
prepost          fixed      2 1 2

Analysis of Variance for outcome, using Adjusted SS for Tests

Source            DF     Seq SS     Adj SS     Adj MS       F      P
subject(method)   19    4440.00    4440.00     233.68    6.52  0.000
method             1     847.48     847.48     847.48    3.63  0.072
prepost            1     542.88     317.69     317.69    8.86  0.008
method*prepost     1     407.41     407.41     407.41   11.36  0.003
Error             19     681.21     681.21      35.85
Total             41    6918.98  

Unusual Observations for outcome 

Obs   outcome       Fit   StDev Fit  Residual   St Resid
  3   35.0000   44.6250      4.4908   -9.6250     -2.43R 
  4   55.0000   45.3750      4.4908    9.6250      2.43R 

R denotes an observation with a large standardized residual.

Expected Mean Squares, using Adjusted SS

Source              Expected Mean Square for Each Term
 1 subject(method)  (5) +  2.0000(1)
 2 method           (5) +  2.0000(1) + Q[2, 4]
 3 prepost          (5) + Q[3, 4]
 4 method*prepost   (5) + Q[4]
 5 Error            (5)

Error Terms for Tests, using Adjusted SS

Source              Error DF  Error MS  Synthesis of Error MS
 1 subject(method)     19.00     35.85  (5)
 2 method              19.00    233.68  (1)
 3 prepost             19.00     35.85  (5)
 4 method*prepost      19.00     35.85  (5)

Variance Components, using Adjusted SS

Source           Estimated Value
subject(method)            98.92
Error                      35.85

Least Squares Means for outcome 

method              Mean     StDev
1                  46.75     3.822
2                  37.50     2.998
prepost
1                  44.96     1.345
2                  39.29     1.345
method*prepost
1      1           46.38     2.117
1      2           47.13     2.117
2      1           43.54     1.661
2      2           31.46     1.661

              BROGAN-KUTNER Section 5 equivalences

MTB > Unstack 'outcome' c60-c61;
SUBC>   Subscripts 'prepost'.
MTB > print c60-c61

Data Display


 Row    C60    C61

   1     51     48
   2     35     55
   3     66     60
   4     40     35
   5     39     36
   6     46     43
   7     52     46
   8     42     54
   9     34     16
  10     40     36
  11     34     16
  12     36     18
  13     38     32
  14     32     14
  15     44     20
  16     50     43
  17     60     45
  18     63     67
  19     50     36
  20     42     34
  21     43     32

MTB > Set c62
DATA>   1( 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2  )1
DATA>   End.
MTB > print c60-c62

Data Display


 Row    C60    C61   C62

   1     51     48     1
   2     35     55     1
   3     66     60     1
   4     40     35     1
   5     39     36     1
   6     46     43     1
   7     52     46     1
   8     42     54     1
   9     34     16     2
  10     40     36     2
  11     34     16     2
  12     36     18     2
  13     38     32     2
  14     32     14     2
  15     44     20     2
  16     50     43     2
  17     60     45     2
  18     63     67     2
  19     50     36     2
  20     42     34     2
  21     43     32     2

===Item #1
MTB > let c63=c60+c61
MTB > twot c63 c62

Two Sample T-Test and Confidence Interval


Two sample T for C63

C62          N      Mean     StDev   SE Mean
1            8      93.5      16.2       5.7
2           13      75.0      24.2       6.7

95% CI for mu (1) - mu (2): ( -0.0,  37.0)
T-Test mu (1) = mu (2) (vs not =): T = 2.10  P = 0.050  DF = 18

MTB > twot c63 c62;
SUBC> pooled.

Two Sample T-Test and Confidence Interval
Two sample T for C63

C62          N      Mean     StDev   SE Mean
1            8      93.5      16.2       5.7
2           13      75.0      24.2       6.7

95% CI for mu (1) - mu (2): ( -1.8,  38.8)
T-Test mu (1) = mu (2) (vs not =): T = 1.90  P = 0.072  DF = 19
Both use Pooled StDev = 21.6

==Item #2
MTB > let c64 = c61 - c60
MTB > twot c64 c62;
SUBC> pooled.
Two Sample T-Test and Confidence Interval
Two sample T for C64

C62          N      Mean     StDev   SE Mean
1            8      0.75      9.74       3.4
2           13    -12.08      7.63       2.1

95% CI for mu (1) - mu (2): ( 4.9,  20.8)
T-Test mu (1) = mu (2) (vs not =): T = 3.37  P = 0.0032  DF = 19
Both use Pooled StDev = 8.47

===Item #3=====
MTB > ttest c64
T-Test of the Mean
Test of mu = 0.00 vs mu not = 0.00

Variable     N      Mean    StDev   SE Mean        T          P
C64         21     -7.19    10.43      2.28    -3.16     0.0049

MTB > 


REPEATED MEASURES ANOVA the long way
============let's start an analysis here=============
==First part gives us 
MTB > glm c3 = c2|c1

Factor   Levels Values
prepost       2     1     2
method        2     1     2


Analysis of Variance for outcome 

Source           DF     Seq SS     Adj SS     Adj MS       F      P
prepost           1      542.9      317.7      317.7    2.36  0.133
 = repeated measure (Within subj part)
method            1      847.5      847.5      847.5    6.29  0.017
 = Group (Factor A) (Betwen subjects part)
prepost*method    1      407.4      407.4      407.4    3.02  0.090
 = GroupxRepeated measure Interaction (Within subjects part)
Error            38     5121.2     5121.2      134.8
Total            41     6919.0  


Unusual Observations for outcome 

Obs.  outcome       Fit Stdev.Fit  Residual   St.Resid
 36   67.0000   31.4615    3.2198   35.5385      3.19R 

R denotes an obs. with a large st. resid.
==================
====Now create the within-groups anova to obtain the 2 error terms
MTB > copy c2-c4 c5-c7;
SUBC> use c1=1.
MTB > twoway c6 c5 c7

ANALYSIS OF VARIANCE  C6      

SOURCE        DF        SS        MS
C5             1       2.2       2.2
C7             7     915.0     130.7  = piece of subjects within groups
                                        Between sujects error term
ERROR          7     331.7      47.4  = piece of subjectsxrepeated measure
                                        within group interaction
                                        Within subjects error term
TOTAL         15    1249.0

MTB > copy c2-c4 c8-c10;
SUBC> use c1=2.
MTB > twoway c9 c8 c10

ANALYSIS OF VARIANCE  C9      

SOURCE        DF        SS        MS
C8             1     948.0     948.0
C10           12    3525.0     293.7   = piece of subjects within groups
                                         Between sujects error term
ERROR         12     349.5      29.1   = piece of subjectsxrepeated measure
                                         within group interaction
                                         Within subjects error term
TOTAL         25    4822.5

915 + 3525 = 4440 (and 7 + 12 = 19df)   Between sujects error term
331.7 + 349.5 = 681.2 (and 7 + 12 = 19df) Within subjects error term

==================
          SAS implementation
data brogk;
input m1 m2 grp;
datalines;
  51     48     1  
  35     55     1  
  66     60     1  
  40     35     1  
  39     36     1  
  46     43     1  
  52     46     1  
  42     54     1  
  34     16     2  
  40     36     2  
  34     16     2  
  36     18     2  
  38     32     2  
  32     14     2  
  44     20     2  
  50     43     2  
  60     45     2  
  63     67     2  
  50     36     2  
  42     34     2  
  43     32     2  
;
proc glm data=brogk;
class grp;
model m1--m2 = grp /nouni;
repeated Time 2 (1 2) / summary printe;
run;

OUTPUT (selected)
         The SAS System            16:13 Tuesday, May 16, 2000  35

                                 The GLM Procedure
                      Repeated Measures Analysis of Variance
                 Tests of Hypotheses for Between Subjects Effects

Source       DF     Type III SS     Mean Square    F Value    Pr > F

grp           1      847.476190      847.476190       3.63    0.0721
Error        19     4440.000000      233.684211

                                 The GLM Procedure
                      Repeated Measures Analysis of Variance
             Univariate Tests of Hypotheses for Within Subject Effects

Source         DF     Type III SS     Mean Square    F Value    Pr > F

Time            1     317.6932234     317.6932234       8.86    0.0078
Time*grp        1     407.4075092     407.4075092      11.36    0.0032
Error(Time)    19     681.2115385      35.8532389
