Help using Base SAS procedures

Problem with quadratic term in Proc Mixed

Reply
N/A
Posts: 0

Problem with quadratic term in Proc Mixed

Hi all,

I am having problems fitting a quadratic term to a model in Proc Mixed. The following is my code (which exactly mimics the code given in Littell's SAS for Mixed Models book at the top of p. 196):

proc mixed data=all_means_analysis noprofile;
title1 'Heterogeneous Autoregressive Mixed Model';
class treatment drought week pot;
model meanphoto = treatment drought week w w2 treatment*drought treatment*week treatment*w treatment*w2 treatment*drought*week treatment*drought*w treatment*drought*w2/htype=1;
repeated week / type=arh(1) sub=pot(treatment);
parms (1.2526) (1.2526) (1.4143) (1.3907) (1.9521) (1.4706) (1.3724) (1.2562) (1.2165) (0.7997) (0.6041) (0.7220) (0.3535) (1.1845) (0.5467) (1.1075) (1.7849) (1.2526) (1.1370) (0.02428) (0.6188) / noiter;
run;

I am trying to look at photosynthetic rate over time, but it decreases over the growing season, so I think I need the quadratic term (w2 = week*week; w = week). But this is the output I get - without any error messages from the SAS system:

Type 3 Tests of Fixed Effects

Num Den
Effect DF DF F Value Pr > F

treatment 2 117 2.36 0.0989
drought 1 117 0.31 0.5790
week 14 779 43.40 <.0001
w 0 . . .
w2 0 . . .
treatment*drought 2 117 5.18 0.0070
treatment*week 27 779 0.97 0.5074
w*treatment 0 . . .
w2*treatment 0 . . .
treatme*drought*week 36 779 10.11 <.0001
w*treatment*drought 0 . . .
w2*treatment*drought 0 . . .

Is the model simply out of degrees of freedom? I have 123 samples, and when I remove some of the interactions from the model to free up some df, the model still will not fit any quadratic terms.

Help?!

Thanks!!!
Respected Advisor
Posts: 2,655

Re: Problem with quadratic term in Proc Mixed

Posted in reply to deleted_user
The problem is that the covariates are completely confounded with week, so that there are no df available for testing their effect.

I would suggest the following:

A. Eliminate week as a class variable. Not so good if there truly is heterogeneity in the response by week (implied by the arh(1) covariate structure).

B. Attack the linear and quadratic trends by using an ESTIMATE, CONTRAST or LSMESTIMATE statement. While this could get somewhat complicated, it is the best I can think of. Having week as a class variable does not preclude it having some polynomial effect, and this could extract that effect efficiently.

Also, you might get some additional responses if you posted in the Statistical Procedures forum.

SteveDenham
N/A
Posts: 0

Re: Problem with quadratic term in Proc Mixed

Posted in reply to SteveDenham
Hi Steve,

Thanks for your reply! I removed week as a class variable, however, that causes a new problem. For the repeated statement, the repeated factor must be a class variable. So, now when I run the model, I get the following error message:

ERROR: Only class variables allowed in this effect.

So, eliminating week doesn't seem to solve the problem... Plus, in the SAS for Mixed Models, they use hour, h, and h2 in the model statement with hour as a class variable and it seems to work.

I will try the ESTIMATE, CONTRAST, LSMESTIMATE statements... maybe that will work....

Any other ideas? I have also posted now to the SAS statistical procedures - thanks for the tip!
N/A
Posts: 0

Re: Problem with quadratic term in Proc Mixed

Posted in reply to deleted_user
Hi Steve,

I think I may have found the solution: Keeping week as a class variable, using it in the REPEATED statement, but removing it from the model and using only w and w2, seems to work.

Now, I just need to decide if keeping the quadratic term in the model is appropriate...

Thanks for your suggestions!
Ask a Question
Discussion stats
  • 3 replies
  • 711 views
  • 0 likes
  • 2 in conversation