Programming the statistical procedures from SAS

A question about 'Example 56.2 Repeated Measures' using proc mixed

Reply
Regular Learner
Posts: 1

A question about 'Example 56.2 Repeated Measures' using proc mixed

[ Edited ]

Example 56.2 uses proc mixed to examine growth measurements for girls and boys at ages 8, 10, 12 and 14. The proposed syntax is:

data pr;
     input Person Gender $ y1 y2 y3 y4;
     y=y1; Age=8;  output;
     y=y2; Age=10; output;
     y=y3; Age=12; output;
     y=y4; Age=14; output;
     drop y1-y4;
     datalines;
    1   F   21.0    20.0    21.5    23.0
    2   F   21.0    21.5    24.0    25.5
    3   F   20.5    24.0    24.5    26.0
    4   F   23.5    24.5    25.0    26.5
    5   F   21.5    23.0    22.5    23.5
    6   F   20.0    21.0    21.0    22.5
    7   F   21.5    22.5    23.0    25.0
    8   F   23.0    23.0    23.5    24.0
    9   F   20.0    21.0    22.0    21.5
   10   F   16.5    19.0    19.0    19.5
   11   F   24.5    25.0    28.0    28.0
   12   M   26.0    25.0    29.0    31.0
   13   M   21.5    22.5    23.0    26.5
   14   M   23.0    22.5    24.0    27.5
   15   M   25.5    27.5    26.5    27.0
   16   M   20.0    23.5    22.5    26.0
   17   M   24.5    25.5    27.0    28.5
   18   M   22.0    22.0    24.5    26.5
   19   M   24.0    21.5    24.5    25.5
   20   M   23.0    20.5    31.0    26.0
   21   M   27.5    28.0    31.0    31.5
   22   M   23.0    23.0    23.5    25.0
   23   M   21.5    23.5    24.0    28.0
   24   M   17.0    24.5    26.0    29.5
   25   M   22.5    25.5    25.5    26.0
   26   M   23.0    24.5    26.0    30.0
   27   M   22.0    21.5    23.5    25.0
   ;

 

   proc mixed data=pr method=ml covtest;
      class Person Gender;
      model y = Gender Age Gender*Age / s;
      repeated / type=un subject=Person r;
   run;

 

With regards to the 'Solution for Fixed Effects' (see below), the authors conclude that "The girls' starting point is larger than that for the boys, but their growth rate is about half of the boys". 

 

Output 56.2.8 Repeated Measures Analysis (continued)
Solution for Fixed Effects Effect Gender Estimate Standard Error DF t Value Pr > |t| Intercept   Gender F Gender M Age   Age*Gender F Age*Gender M
15.84230.93562516.93<.0001
1.58311.4658251.080.2904
0....
0.82680.079112510.45<.0001
-0.35040.123925-2.830.0091
0....

 

So my question is why age was not included in the class statement? 

A proc means analysis for age=8 shows that the value for boys is larger than that for girls. Also below is the solution for fixed effects when age(ref=first) is added to the class statement. Wouldn't this better reflect the data?

 

Analysis Variable : y Gender N Obs N Mean Std Dev Minimum Maximum F 11 M 16
1121.18181822.124532016.500000024.5000000
1622.87500002.452889517.000000027.5000000
 
Solution for Fixed Effects Effect Gender Age Estimate Standard
Error DF t Value Pr > |t| Intercept     Gender F   Gender M   Age   10 Age   12 Age   14 Age   8 Gender*Age F 10 Gender*Age F 12 Gender*Age F 14 Gender*Age F 8 Gender*Age M 10 Gender*Age M 12 Gender*Age M 14 Gender*Age M 8
22.87500.55982540.86<.0001
-1.69320.877125-1.930.0650
0....
0.93750.4910251.910.0678
2.84380.4842255.87<.0001
4.59380.5369258.56<.0001
0....
0.10800.7693250.140.8895
-0.93470.758525-1.230.2293
-1.68470.841125-2.000.0561
0....
0....
0....
0....
0....
SAS Super FREQ
Posts: 3,547

Re: A question about 'Example 56.2 Repeated Measures' using proc mixed

Age is a continuous variable, so the model treated it as such. The authors want one parameter to indicate the dependence on age.

 

If the subjects were classifed as "Children", "Teenagers", and "Adults", then the variable would be treated as a classification effect. There would be three parameters (two independent parameters) in that model.

Respected Advisor
Posts: 2,655

Re: A question about 'Example 56.2 Repeated Measures' using proc mixed

If you want to account for possible nonlinearity of response due to age, you could change the code slightly (including age as a class effect) to get:

 

proc mixed data=pr method=ml covtest;
      class Person Gender Age;
      model y = Gender Age Gender*Age / s;
      repeated  Age/ type=un subject=Person r;
   run;

Note that this will "use up" some degrees of freedom, so that standard errors may be larger and tests somewhat different.  There are many ways to proceed at this point, especially if you wished to make comparisons of expected values at various ages.

 

Steve Denham

 

 

Ask a Question
Discussion stats
  • 2 replies
  • 133 views
  • 0 likes
  • 3 in conversation