## Ancova error term

Occasional Contributor
Posts: 5

# Ancova error term

It is me again. I figured out I needed to do Ancova. I had a 2x2 factorial design with 3 replications, and the data was taken weekly over 7 weeks. Is this the correct code? How do I know which error term to report?  Should I report the error term that takes the repeated measure week into account? My professor told me SAS used to have a problem reporting the correct error term for repeated measures.

proc glm data=s;
class treatment;
model average_counts0 average_counts1 average_counts2 =treatment rep treatment*rep /nouni;
repeated week 3/printe nom;
run;

SAS Output

 The SAS System

The GLM Procedure
Repeated Measures Analysis of Variance
Tests of Hypotheses for Between Subjects Effects

Source DF Type III SS Mean Square F Value Pr > F
Treatment 3 1.78040181 0.59346727 3.80 0.0118
Rep 1 0.66332103 0.66332103 4.25 0.0412
Rep*Treatment 3 0.92948843 0.30982948 1.98 0.1193
Error 136 21.23583583 0.15614585

 The SAS System

The GLM Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects

Source DF Type III SS Mean Square F Value Pr > F Adj Pr > F
G - G H-F-L
week 2 2.77357192 1.38678596 8.82 0.0002 0.0020 0.0020
week*Treatment 6 3.26141864 0.54356977 3.46 0.0026 0.0124 0.0123
week*Rep 2 1.07724032 0.53862016 3.43 0.0339 0.0584 0.0582
week*Rep*Treatment 6 1.88501088 0.31416848 2.00 0.0661 0.1045 0.1043
Error(week) 272 42.75783285 0.15719791
Posts: 2,034

## Re: Ancova error term

I'm not seeing the need to do ANCOVA here, I do see the need to perform a repeated measures design. And the outputs you are showing seems to indicate your performed a split-plot design, not ANCOVA — even though the titles/labels indicate you did a repeated measure analysis (which I don't think you did). Could we see your code?

So, taking a step backwards for a second, ANCOVA, split-plot and repeated measures are all relatively similar analyses, and the difference in my mind is that the proper error terms change from ANCOVA to split-plot to repeated measures (and the degrees of freedom change as well), which means that the statistical tests change.

The entire design needs to be considered in figuring out exactly which analysis should be done, and based on my understanding of what you wrote, this seems more like a repeated measures, but I'd encourage others to chime in. You can read more about performing repeated measures analysis in SAS Help documentation.

--
Paige Miller
Occasional Contributor
Posts: 5

## Re: Ancova error term

[ Edited ]

Here is my code-

proc glm data=s;
class treatment;
model average_counts0 average_counts1 average_counts2 =treatment rep treatment*rep /nouni;
repeated week 3/printe nom;
run;

I think the repeated measures anova is the correct analysis to do here. Is my code correct? I am ultimately looking for an error term nested in treatment and week. The reason I thought I might be doing ancova is I had 3 inoculum concentrations for each of the replications and I was treating them as the covarients.

also, here is what my professor said-

You need to run the analysis using the inoculum concentrations as a covariant in the model as you look at the rep x trt interaction.  by using the inoculum concentration the analysis accounts for that variation.  THe repeated measures error term needs to be defined.  SAS in years past could not identify the error term in the repeated measures model.  Whoever you are consulting with on your analyis should be capable of specifying the error term.  THe default error term selected by SAS may be the correct one, but you need to verify that and report it.

Posts: 2,034

## Re: Ancova error term

Your code looks fine to me.

Yes, if you want the inoculum concentrations to be included, then you could choose to call this analysis ANCOVA, but that's just wording at this point.

I don't know what your professor is referring with regards to identifying the error term. Perhaps if I worked this through as a real problem, I'd figure it out, but it's your real problem to work through, not mine.

Professor says: "Whoever you are consulting with on your analyis should be capable of specifying the error term." I think this is nonsense, the design of the study and the analysis chosen determines the proper error term. The person you are consulting with shouldn't have to provide this error term, and probably doesn't even know what you are talking about. It is the statisticians job to figure out the proper error term and then use it properly.

--
Paige Miller
Posts: 2,655

## Re: Ancova error term

I guess I would approach this in a completely different manner.  I see repeated measures and a random effect here.  Thus, I would run as far away from PROC GLM as possible.  Your professor is absolutely right about PROC GLM and error terms.

First, try recoding your data into long format:

data long;

set s;

time=0; avcounts=avg_counts0;output;

time=1; avcounts=avg_counts1;output;

time=2; avcounts=avg_counts2;output;

drop avg_counts0 avg_counts1 avg_counts2;

run;

proc mixed data=long;

class time treatment rep subjectid; /* This assumes that you have separate measurements by subject within rep */

model avcounts=time treatment time*treatment;

random rep;

repeated time/type=ar(1) subject=subjectid;

run;

Steve Denham

Discussion stats
• 4 replies
• 267 views
• 0 likes
• 3 in conversation