# What post-hoc analysis should I use following a two-way ANCOVA with factor, integer and numeric variables?

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 ...

• 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. – Isabella Ghement Dec 20 '18 at 18:02
• 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. – Isabella Ghement Dec 20 '18 at 18:05