In an experiment, we evaluated the effect of decreasing or increasing the roughage content in feedlot diets: We have a standard diet with 12% roughage, one as a negative control with 7% roughage for the entire 100 days of confinement (D1 and D2), a diet that starts with 12% roughage for 50 days and then decreases to 7% in the last 50 days (D3), and the last diet that starts with 7% roughage for 50 days and then increases to 12% in the last 50 days (D4). The hypothesis of the study is that by increasing the roughage at the end of confinement, we increase feed intake and consequently the performance of beef cattle. I thought about analyzing this experiment as a 2x2 factorial (two diets with fixed roughage content and two changes in roughage content), or conducting orthogonal contrasts D1vsD2, D1vsD3, and D1vsD4. Or performing a response surface regression analysis over time, but I have no idea how to do that because I've never done it before.
Are you saying that you don't know how to input the data into SAS? Or you don't know how to specify a specific model?
If the former, here's an example of using the SAS DATA step to input data, followed by a two-factor ANOVA model:
data Cattle;
label Feed0="Roughage in Feed Days 1-50"
Feed50="Roughage in Feed Days 51-100"
Weight = "Weight after 100 Days";
input ID Feed0 Feed50 Weight;
datalines;
1 7 7 500
2 7 7 515
3 7 7 502
4 7 7 505
5 7 7 512
6 7 12 530
7 7 12 534
8 7 12 536
9 7 12 541
10 7 12 558
11 12 7 523
12 12 7 515
13 12 7 535
14 12 7 522
15 12 7 518
16 12 12 555
17 12 12 555
18 12 12 565
19 12 12 584
20 12 12 540
;
proc glm data=Cattle;
class Feed0 Feed50;
model Weight = Feed0 | Feed50 / solution;
run;
For the example, the SS indicate that the interaction effect is not significant, so you could rerun the model as
model Weight = Feed0 Feed50;
I don't think you have enough design points to fit a quadratic response surface. Assuming that you are trying to measure mean weight of the cattle, a general quadratic response is
Weight = A + B*x + C*y + D*x**2 + E*x*y + F*y**2
which has six parameters. You only have four design points, so you can't fit the quadratic response surface.
A 2x2 factorial sounds like a reasonable design.
I understand, I just don't know how to put this in the sas programming, how to separate these factors
Are you saying that you don't know how to input the data into SAS? Or you don't know how to specify a specific model?
If the former, here's an example of using the SAS DATA step to input data, followed by a two-factor ANOVA model:
data Cattle;
label Feed0="Roughage in Feed Days 1-50"
Feed50="Roughage in Feed Days 51-100"
Weight = "Weight after 100 Days";
input ID Feed0 Feed50 Weight;
datalines;
1 7 7 500
2 7 7 515
3 7 7 502
4 7 7 505
5 7 7 512
6 7 12 530
7 7 12 534
8 7 12 536
9 7 12 541
10 7 12 558
11 12 7 523
12 12 7 515
13 12 7 535
14 12 7 522
15 12 7 518
16 12 12 555
17 12 12 555
18 12 12 565
19 12 12 584
20 12 12 540
;
proc glm data=Cattle;
class Feed0 Feed50;
model Weight = Feed0 | Feed50 / solution;
run;
For the example, the SS indicate that the interaction effect is not significant, so you could rerun the model as
model Weight = Feed0 Feed50;
That's right, understand! I made a similar script thinking about repeated measurements over time, what do you think? (see below)
data cattle;
input ID Pen day Factor1 /*(0-50days)*/ Factor2 /*(51 - 100days)*/ Dry_matter_intake;
cards;
1 1 1 7 7 10
2 2 1 7 7 9.5
3 1 1 7 7 9.6
4 2 1 7 7 9.9
5 1 1 7 7 10.5
6 2 1 7 12 10
7 1 1 7 12 9.5
8 2 1 7 12 9.6
9 1 1 7 12 9.9
10 2 1 7 12 10.5
11 1 1 12 12 10
12 2 1 12 12 9.5
13 1 1 12 12 9.6
14 2 1 12 12 9.9
15 1 1 12 12 10.5
16 2 1 12 12 10
17 1 1 12 7 9.5
18 2 1 12 7 9.6
19 1 1 12 7 9.9
20 2 1 12 7 10.5
;
proc mixed data=a;
class ID Pen day Factor1 Factor2;
model Dry_matter_intake = Factor1|Factor2|day pen /ddfm=kr;
repeated day / subject = ID type= ante(1);
random id;
lsmeans Factor1|Factor2|day/ pdiff adjust = tukey ;
run;
> what do you think?
I think that if you change DATA=A to DATA=cattle, then you have valid syntax. I'm not in the habit of saying whether a model is correct or not, because it depends on the design and the research objectives. However, here are a few thoughts:
1. This is going to be a HUGE model if you specify DAY to be a classification variable with 100 levels. Perhaps you might want to consider DAY to be a continuous variable?
2. Depending on how many animals you have in the study, you still might end up with a huge model. You might want to read the paper, "All the Cows in Canada: Massive Mixed Modeling with the HPMIXED Procedure" for an overview of large mixed models in SAS and alternative procedures to fit them.
3. I think your procedure could be enhanced by looking at some boxplot of the mean response for each factor. See the doc for the PROC MIXED statement to see how to specify the various boxplots, or use PLOTS=BOXPLOT to see an assortment.
I understand, thank you very much, it helped me a lot!
I will read the indicated material and think more about the approach and discuss it with the group.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.