BookmarkSubscribeRSS Feed
Theresa_S
Calcite | Level 5

Dear SAS community,

Me and my project partner are SAS and statistics newbies. We are working on a project in which we fertilize ryegrass in pots with different 5 fertilizer treatments. We positioned them in a randomized 5x5 Latin Square (5 treatments with each 5 repetitions).  We evaluated height (Hohe), Carbon (C), Nitrogen (N), Carbon/Nitrogen Ratio (CN), fresh matter (FM) and dry matter (DM). The tricky thing is that there were two cuts, one after about a 6 weeks, and the second one about 10 weeks after sowing. Each time all six parameters named before were measured.

We got the code below from a statistician of our university, but we are not sure how to describe it and we don´t really understand it.

For your understanding: Variante = fertilizer treatment, Zeile = line, Spalte = column, Schnitt = cut

The ods and mult statements are due to a macro, which creates letter displays, so you can probably ignore that.

 

We could use two different models.This is the first one: (which is a bit easier but I think it does not allow comparisons between cuts, all I can say is if values for height are significantly different from each other within the same cut between different fertilizers?)

 

proc mixed data=Tofuversuch;
by Schnitt;
class Variante Zeile Spalte Schnitt;
model Hohe=Zeile Spalte Variante/ddfm=kr outp=r residual;
lsmeans Variante/pdiff;
ods output lsmeans=lsmeans1 diffs=diffs1;
run;

data lsmeans;set lsmeans1;where Schnitt=1;run;
data diffs;set diffs1;where Schnitt=1;run;
%mult(trt=variante);
data lsmeans;set lsmeans1;where Schnitt=2;run;
data diffs;set diffs1;where Schnitt=2;run;
%mult(trt=variante);

 

 

This is the second model:

proc mixed data=Tofuversuch;
class Variante Zeile Spalte Schnitt;
model Hohe=Zeile Zeile*Schnitt Spalte Spalte*Schnitt Variante Variante*Schnitt Schnitt/ddfm=kr outp=r residual;
repeated Schnitt/subject=Zeile*Spalte type=arh(1);
lsmeans Variante*Schnitt/pdiff;
ods output lsmeans=lsmeans diffs=diffs;
%mult(trt=variante, by=Schnitt);
%mult(trt=Schnitt, by=variante);
run;

 

For the second model we do not understand the whole repeated statement. We also are not sure about the meaning of the * signs between the explanatory variables.

We are thankful for any kind of interpretation of the code and help to describe code 2 for our methods part (a two-fold ANOVA?). Let me know if you need more information in order to help.

 

Many thanks in advance,

Theresa

 

 

1 REPLY 1
Rick_SAS
SAS Super FREQ

The first model uses a linear main-effects model:

Hohe=Zeile Spalte Variante

Notice that the Schnitt variable is not included in this model. Instead, the analysis is performed for each level of the Schnitt variable (because of the BY statement). 

 

The second model includes interactions between variables. The '*' is used to include the interaction term between the variables and the Schnitt variable:

 Hohe=Zeile Spalte Variante Zeile*Schnitt Spalte*Schnitt Variante*Schnitt Schnitt.

(See the doc for how to specify effects on the MODEL statement.) Because the Schnitt variable is in the model, you can compare how different values of the Schnitt variable affect the response variable.

 

The REPEATED statement (see the doc) enables you to model the fact that each subject in the study contributed multiple observations. Most likely, responses from the same subject are correlated. The REPEATED statement tries to account for the fact that the responses are not independent.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1 reply
  • 249 views
  • 1 like
  • 2 in conversation