BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Dicarlis
Obsidian | Level 7

Hi, my new problem is:
In our trail, we need to control a lot of effects, example: animal, mother this animal, father this animal, season of bron (3 months rang) and pen.
We were using the 2x2 factorial array.
Each treatments are composed for 2 factors for each animal.
Our problem is that all this factors influence the response varible ex average gain daily (animal, mother this animal, father this animal, season of bron and pen).
Before we use the model :
PROC MIXED;
CLASS mother father factor1 factor2 animal born_season pen time;
model PV= factor1|factor2|time / DDFM=KR;
RANDOM mother father animal born_season pen time;
REPEATED time/ TYPE = ar(1) SUBJECT = animal(factor1|factor2);
RUN;

But now we want to isolate the effects of the factors 1 and 2, we think that for this we need to use the covariate effect, The model looks like this:
PROC MIXED;
CLASS mother father factor1 factor2 animal born_season pen time;
model PV= factor1|factor2|time mother father animal born_season pen time / DDFM=KR;
RANDOM animal;
REPEATED time/ TYPE = ar(1) SUBJECT = animal(factor1|factor2);
RUN;
Do you agree with this approach?

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

See, there were some things I still did not know. If each subject has a mother different to all the other subjects, then I would remove mother from the analysis completely, as it is completely confounded with the subject. Including it could lead to odd behavior of the algorithm. As far as the father as a fixed effect, I am good with that as well. In animal breeding studies, it is often the case that what looks like a random effect is actually better handled as a fixed effect. An example would be season or year when you are estimating BLUPs for a lot of sires.

 

So, maybe this code would be useful:

 

PROC MIXED;
CLASS father factor1 factor2 animal born_season pen time;
model PV= factor1|factor2|time / DDFM=KR;
RANDOM  animal born_season pen ; /*removed time, to treat it solely as an R-side effect = correlated residuals)
REPEATED time/ TYPE = ar(1) SUBJECT = animal;
RUN;

I think you may want to consider changing born_season to a fixed effect. It may interact with one or both of the experimental factors. This will be a case where plots of the data would be useful.

 

SteveDenham

 

View solution in original post

5 REPLIES 5
sbxkoenk
SAS Super FREQ

I moved this post to "Statistical Procedures"-board.
Home > Analytics > Statistical Procedures

 

@Dicarlis 

For inserting SAS-code in your post, click the "Insert SAS Code" icon in the header (it's the little running man in a square and a dot in the bottom right-hand corner). Paste your code in the pop-up window. That way structure and formatting of the SAS code is preserved.

 

Koen

SteveDenham
Jade | Level 19

That model statement probably is not what you want to do, as it restricts the inference space to only those members of the fixed effects, and ignores any interaction between factor1 or factor2 and the added covariates.

 

However, given the field you are working in, I would prefer to treat sire and dam as random effects, as they are likely representative of the population, and in other studies, handled as normal(0, variance of sire or dam). If you are able to accept that, then the following code may be of use:

 

 

PROC MIXED;
CLASS mother father factor1 factor2 animal born_season pen time;
model PV= factor1|factor2|time / DDFM=KR;
RANDOM mother father animal born_season pen ; /*removed time, to treat it solely as an R-side effect = correlated residuals)
REPEATED time/ TYPE = ar(1) SUBJECT = animal(factor1|factor2);
RUN;

There are two other issues to address. The first is the subject for the REPEATED statement. You can only use the nested syntax for the subject. In other words, factor1|factor2 is going to result in an error. I notice that in the RANDOM statement you specify 'animal'. That would imply (at least to me) that each animal on study has a unique identifier. If that is the case, I suggest using SUBJECT = animal in the REPEATED statement. If the animals are not uniquely identified, then you should nest animal within the proper effect, which is almost certainly not the levels of factor1, factor2 or their interaction.

 

The second subject is the use of the older Kenward-Rogers denominator degrees of freedom. This has been shown to have non-optimal qualities for algorithms that use second-order methods (NRRIDG, QUANEW, etc.). Consider the use of KR(FIRSTORDER) or KR2.  If your data are unbalanced over the repeated measure, then you may see strange degrees of freedom associated with the use of KR2 (say 1 df for time). If that occurs, then you may need to explicitly state the degrees of freedom, and use an empirical shrinkage method.

 

SteveDenham

Dicarlis
Obsidian | Level 7

Hey Steve,
How are you ?
Thank you very much for your reply!
I studied it and it became clear that the mother effect must be random and is synonymous with the animal effect (they have a unique identification). Now the father effect is more complicated, as they are only 3 individuals within the population, because in our study we tried to control this effect to understand the effect of factors 1 and 2 that were applied to the mother during pregnancy and what this would imply during the life of the child (animal). So I understand that the father effect should be a fixed effect, although we are not interested in studying this effect that we are trying to control, but for many variables it has a significant effect, but I am still not confident if this is really the best approach.

SteveDenham
Jade | Level 19

See, there were some things I still did not know. If each subject has a mother different to all the other subjects, then I would remove mother from the analysis completely, as it is completely confounded with the subject. Including it could lead to odd behavior of the algorithm. As far as the father as a fixed effect, I am good with that as well. In animal breeding studies, it is often the case that what looks like a random effect is actually better handled as a fixed effect. An example would be season or year when you are estimating BLUPs for a lot of sires.

 

So, maybe this code would be useful:

 

PROC MIXED;
CLASS father factor1 factor2 animal born_season pen time;
model PV= factor1|factor2|time / DDFM=KR;
RANDOM  animal born_season pen ; /*removed time, to treat it solely as an R-side effect = correlated residuals)
REPEATED time/ TYPE = ar(1) SUBJECT = animal;
RUN;

I think you may want to consider changing born_season to a fixed effect. It may interact with one or both of the experimental factors. This will be a case where plots of the data would be useful.

 

SteveDenham

 

Dicarlis
Obsidian | Level 7

Now everything is clear,
I'm sorry for not being able to explain it properly the first time and thank you very much for your help!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1421 views
  • 9 likes
  • 3 in conversation