0
$\begingroup$

I ran a two-way ANCOVA on the data below, in r-studio, to determine whether pupal weights Pupal.wt were affected by caterpillars' diet Trt, initial weights Initial.wt, and the amount of time it took each caterpillar to reach pupation Larval.period: aov(Pupal.wt ~ Trt*Initial.wt*Larval.period, data = GM). Is a Tukey HSD test sufficient to follow this analysis? If so, how can I change either the code or my data to make TukeyHSD() work (I get this error message when I try to run it:

ANCOVA <-aov(Pupal.wt ~ Trt*Initial.wt*Larval.period, data=GM)
TukeyHSD(ANCOVA) 

Error in rep.int(n, length(means)) : unimplemented type 'NULL' in 'rep3' 
In addition: Warning messages: 1: In replications(paste("~", xx), data = mf) :   
non-factors ignored: Initial.wt 2: In replications(paste("~", xx), data = mf) :   
non-factors ignored: Larval.period 3: In replications(paste("~", xx), data = mf) :   
non-factors ignored: Trt, Initial.wt 4: In replications(paste("~", xx), data = mf) :   
non-factors ignored: Trt, Larval.period 5: In replications(paste("~", xx), data = mf) :   
non-factors ignored: Initial.wt, Larval.period 6: In replications(paste("~",xx), data=mf):
non-factors ignored: Trt, Initial.wt, Larval.period

Here are my data:

> str(GM)
'data.frame':   44 obs. of  5 variables:
 $ Trt           : Factor w/ 2 levels "Infested","Uninfested": 2 2 2 2 2 2 2 2 2 2 ...
 $ Larval.period : int  14 20 18 18 26 14 22 26 20 18 ...
 $ Initial.wt    : num  0.181 0.318 0.218 0.195 0.25 0.181 0.213 0.255 0.236 0.298 ...
 $ Pupal.wt      : num  0.294 0.519 0.527 0.326 0.511 0.299 0.584 0.442 0.481 0.452 ...
 $ X..weight.gain: num  62.4 63.2 141.7 67.2 104.4 ...
$\endgroup$
  • $\begingroup$ It seems your terminology is off - a two-way Ancova would imply that your model includes two factors (one of whom is Treatment), presumed to be of primary interest, and one or more numerical variables you need to control for and which are of secondary interest in addressing your research question(s). However, as @gung pointed out, you only have one factor in your model, so at best you would have a one-way Ancova. In any event, for an Ancova analysis, you would want to use the lm() function. $\endgroup$ – Isabella Ghement Dec 20 '18 at 18:02
  • 1
    $\begingroup$ Are you primarily interested in the effect of Treatment on Pupal Weight? Do you believe this effect might be different depending on Initial Weight and Larval Period? You need to clarify your research question first. $\endgroup$ – Isabella Ghement Dec 20 '18 at 18:05
1
$\begingroup$

This seems to be due to a confusion on your part about the necessity (and even applicability) of post-hoc tests. When you have a categorical variable with multiple levels (e.g., several subspecies) and you get a test of that variable, you are testing that variable as a whole. Assuming the test is significant, it implies that there is some difference somewhere amongst the various levels, but you don't know where. The post-hoc test follows the initial test of the variable to help you identify what levels might differ from each other.

In your case, you have only one categorical variable (factor), so the others are appropriately ignored. In addition, your only factor (treatment) has only two levels ("infested", and "uninfested"). So if there is reason to believe that there are differences amongst the levels somewhere, and there are only two, logically, the difference has to be between those two. In other words, there is nothing here to test with Tukey's test.

You have a three dimensional space comprised of pupal weight, initial weight and larval period. Your model is fitting a plane, that is allowed to twist as necessary, that picks out the mean pupal weight as a function of the initial weight and the larval period. With two levels of treatment, the model fits two such planes, one each for infested and uninfested. If the three way interaction is significant, it means that these planes are tilted and/or twisted differently from each other, as well as possibly shifted up or down. To understand your results more fully, you should try to make some plots, or at least solve the regression equation for different points in the covariate space for each treatment level. However, there is no need to try to use Tukey's test to determine which set of two levels are the two that differ out of the (only two) levels that you have.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.