Help using Base SAS procedures

Tutoring a newbie to Proc GLIMMIX, model creation

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Tutoring a newbie to Proc GLIMMIX, model creation

Hello all,

I am a newbie to Proc Glimmix, so please bear with me.

I have included my statistical model below.

Effect

d.f.

Effect Type

Test

Type (T)

1

Fixed

(Categorical Variable)

 

Age (A)

2

Fixed

(Categorical Variable)

 

T*A

2

Fixed

 

Forest(T*A)

6

Random

Error term 1

 

 

 

 

Year (Y)

1

Fixed

(Categorical Variable)

 

Y*T

1

Fixed

 

Y*A

2

Fixed

 

Y*T*A

2

Fixed

 

Y*Forest(T*A)

6

Random

Error term 2

Total Error

120

Random

 

Total

143 (N=144)

 

 

The response variables are continuous.

I'm not sure how to write a correct model statement in proc glimmix, as I am not familiar with how the random, subject and intercept statements work. I would like to test the fixed effects of Type, Age and Type*Age against the random variable of Forest(Type*Age), as well, test the fixed effects (and the interactions) of Year against the random effect of Year*Forest(T*A).  In GLM, I could use the 'test' statement (using H and E syntax), but am not sure how this is done in glimmix. I realize that I may in the end reduce the model by removing certain random terms, but need to check against the full model first.

Here was my first SAS code, not sure if this is correct:

 

proc glimmix data = Trapabund;
  class Type Age Stand Year;
  model TrpSTD = Type | Age | Year ;
    random Forest(Type*Age);
    random Year / subject=Year*Forest(Type*Age);
    lsmeans Type Age_Cat Type*Age_Cat Year Year*Type*Age_Cat / cl adjust=tukey alpha=0.05 lines;
    run;
    quit;

 

Any help and advice would be greatly appreciated.

PS-I have to be away from the office Thursday and Friday, so I may not be able to respond until Monday of next week.


Accepted Solutions
Solution
‎05-16-2016 09:40 AM
Frequent Contributor
Posts: 102

Re: Tutoring a newbie to Proc GLIMMIX, model creation

Forest cannot be a repeated measure because you don't expect any forest to be affected by other forests. Forest is just a random effect reflecting the fact that the rates of whatever you're measuring randomly vary from one forest to the next. The repeated measures effect is the Year with Subject=Forest.

Your Age effect has nothing to do with Year but I don't understand why you have Year in the model. What is your research question about changes from the first Year bugs to the second Year bugs or do you even have one? As long as the samples were collected in the same time-frame in all forests, you can assume that the year effects apply equally to all forests and they don't seem to need to be in the model. If you don't have a cross-sectional design as far as the years of collection, then Year may be important. Year could also be important if you expect some kind of interaction between year and forest or year and the other two predictors.

Seems like for your model you only need to consider Type|Age effects and for your random statement you need a simple RANDOM Forest; statement. Whether or not the outcomes change from the first year to the second is irrelevant, unless your samples in the two years are not equal.

View solution in original post


All Replies
Frequent Contributor
Posts: 102

Re: Tutoring a newbie to Proc GLIMMIX, model creation

Super confusing.

 

Looks like you want to have random intercepts for each distinct combination of Forest*Type*Age.  I would program that as:

 

RANDOM Intercept / subject=Forest*Type*Age;

 

If each forest has a unique identifier, you only need SUBJECT=Forest.

 

 

The second random effect seems to be for a repeated measures variable Year.  I would use the same syntax but specify a covariance type--first order autoregressive is the most common choice for time but it may or may not be appropriate:

 

RANDOM Year / subject=Forest*Type*Age type=AR(1);

 

No covariance is the default for your first random statement but you may want to include TYPE=VC to see that explictly in your code.  If you don't believe that there is covariance between/among years, you only need one random statement with both random intercept and years in it:

 

RANDOM Intercept Year / subject=Forest*Type*Age;

 

 

Occasional Contributor
Posts: 5

Re: Tutoring a newbie to Proc GLIMMIX, model creation

Hi Haris, thanks for the information.

What we did was sample insects in a combination of fire and harvest stands (Type effect) after a set amount of time post-disturbance (Age effect: 0-1 year, 14-15 years, 29-30 years after the fire or harvest occurred). For our interests, we considered the Age effect categorical (simply as 0, 15, 30 years post disturbance). We sampled the insects for 2 consecutive years in the same forests, so the forests may be considered the repeated measure (?), however, I recognize the conundrum of the 'age' effect and the 'sampling time' effect.  We are interested mostly in the Type*Age interaction, but recognize that year of collection also plays a role in what was collected.

I'm not sure if this helps to clarify the situation, or only makes thngs more difficult.

Cheers,

BM

Solution
‎05-16-2016 09:40 AM
Frequent Contributor
Posts: 102

Re: Tutoring a newbie to Proc GLIMMIX, model creation

Forest cannot be a repeated measure because you don't expect any forest to be affected by other forests. Forest is just a random effect reflecting the fact that the rates of whatever you're measuring randomly vary from one forest to the next. The repeated measures effect is the Year with Subject=Forest.

Your Age effect has nothing to do with Year but I don't understand why you have Year in the model. What is your research question about changes from the first Year bugs to the second Year bugs or do you even have one? As long as the samples were collected in the same time-frame in all forests, you can assume that the year effects apply equally to all forests and they don't seem to need to be in the model. If you don't have a cross-sectional design as far as the years of collection, then Year may be important. Year could also be important if you expect some kind of interaction between year and forest or year and the other two predictors.

Seems like for your model you only need to consider Type|Age effects and for your random statement you need a simple RANDOM Forest; statement. Whether or not the outcomes change from the first year to the second is irrelevant, unless your samples in the two years are not equal.
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 257 views
  • 3 likes
  • 2 in conversation