# Compare several regression lines ANCOVA?

I´m about to make a comparison I had never performed so I ask you to excuse me if the question is too obvious. I´m trying to analyze the relation between number of movements and prey capture time on spiders under different temperature treatments. I have four regresion lines (corresponding to different temperatures) and I want to compare the slopes of these lines.

I performed a preliminar covariance analysis in R, and it indicates there is no correlation between the data I´m analyzing. Nevertheless, reading some posts. I´ve found out that I made some violations, because data are very non-normal and the variances are non-homogeneous. After trying several transformations I could not get the conditions. So my questions are:

1) Do I need to know another assumption of the test?

2) If correct, does it exist a non parametric alternative to the ANCOVA or another way to compare the slopes?

3) Finally since I´m getting familiar with the test, I´d like to know why in some cases is it necessary to perform an ANOVA after making the ANCOVA?

Just in case, I attach the preliminary analysis I performed in R. Thanks for any help or advice.

ancova <- lm(Tiempo~Movimientos*Grupo)
summary(ancova)

Coefficients:

Estimate Std. Error t value Pr(>|t|)
(Intercept)          13.4444     1.0521  12.778 1.94e-13 ***
Movimientos          -1.0000     0.3051  -3.277  0.00272 **
GrupoG2              -5.8089     3.6488  -1.592  0.12223
GrupoG3              -3.7914     3.5522  -1.067  0.29463
GrupoG4               0.7345     1.4494   0.507  0.61615
Movimientos:GrupoG2   0.6356     0.4424   1.437  0.16148
Movimientos:GrupoG3   0.4082     0.5616   0.727  0.47321

Movimientos:GrupoG4   0.4184     0.3879   1.079  0.28959

anova(ancova)

Analysis of Variance Table

Response: Tiempo

Df Sum Sq Mean Sq  F value    Pr(>F)
Movimientos        1 429.04  429.04 177.2294 6.988e-14 ***
Grupo              3  61.10   20.37   8.4125 0.0003554 ***
Movimientos:Grupo  3   5.33    1.78   0.7341 0.5401739
Residuals         29  70.20    2.42
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Why are you calling this ANCOVA? If it were an ANCOVA then you would be adding in some covariate that explains variability in the response variable but that is not a predictor in the model. That covariate would not require a linear relationship. This is just a 2-way regression with an interaction. From your description it's not even clear why you would want an ANCOVA.

If you want to see if the slopes depend upon the group you've already got that. There is no interaction between group and slope, therefore slope does not depend on group.

How did you assess normality? You want to do it on the residuals, not on the data. Try

plot(ancova)


These plots will help you assess whether the data meet the assumptions of the regression.

• If residuals are normally distributed with 0 mean then the observed ys are norml with mean bx. But it is true that the residuals are the variables that are tested for normality. – Michael R. Chernick Jun 28 '12 at 9:46
• How does the implication work in the first sentence of your comment, @Michael? You seem to be implicitly assuming the independent variables have a normal distribution, but that's not applicable here where many of the dependent variables are binary indicators for the groups! Do you mean to say that the dependent values are (a) normal within each group, (b) assuming all covariates are normally distributed? – whuber Jun 28 '12 at 13:21
• Your first remark isn't complicated Michael, but it is a bit vague. It would be terribly tedious, and highly unlikely of this questioner (given the wording of the question), to have tested for normality of y at each b. Given that it wasn't mentioned that the residuals were what was tested for normality, and it's kind of implied normality was assessed before the model was calculated, it's reasonable to advise the residuals be examined. A questioner as naive as this one might actually take your comment as evidence that they can just check normality of the y values. – John Jun 28 '12 at 14:45
• The observations will be normally distributed within each condition and there's a continuous predictor. Unless you have a LOT of data you can't assess normality of the observations in this case. You need to assess the residuals. So, while you're technically correct I'm not sure why you're trying to make the point. It's very unlikely the questioner (or anyone) could have properly assessed normality of the observations. – John Jun 28 '12 at 22:28
• Then you're just stating that if the questioner had reworded their statement about normality of the data it would be fine? Besides your comment not being entirely correct it doesn't seem to have a point. There is something wrong with saying that if the residuals are normal the observations will be normal. It's quite simply not true unless you make a more specific statement. That's something your comment begins but doesn't really go far enough with. When there's a continuous predictor you need more than normal with mean bx, or normal in each condition. – John Jun 29 '12 at 21:40

If you are doing linear regression but the residuals are very non-normal then there are robust regression alternatives. For ANOVA the nonparametric analogs are the Kruskal-Wallis test and Friedman's test. For regression functions that cannot be easily expressed as linear in the parameters there are nonlinear regression methods and nonparametric smoothing approaches such as LOESS.

• Thanks both for your answer,. I do not know if the question was clear, I´m just trying to compare the slopes of four regression lines. I read an ANCOVA could work, better than an ANOVA on this case, but it is not clear for me when to use each test. If the ANOVA is not the proper way then, what test should be used to compare several regression lines? – user12257 Jun 29 '12 at 21:06
• If you want to compare if the regression lines had the same slope, then test for a homogeneity of slope test. If those slopes are homogeneous and then you need to test wether they differ in the interecept value, go ahead and run an ANCOVA with homogeneous slopes. The ANCOVA TEST FOR DIFERENCES IN THE ADJUSTED MEANS OF THE 4 TREATMENTS, WILL NOT TEST YOU FOR DIFFERENCES IN THE SLOPES, hope it helped! – AnastD Aug 15 '12 at 14:40
• @Damian Homogeneity seems to be the wrong term. I think you mean equality of slopes. – Michael R. Chernick Aug 15 '12 at 15:06
• @MichaelChernick, you are right, excuse my poor english. i mean equality of slopes, or in some other textbook the assumption of parallelism, cheers – AnastD Aug 15 '12 at 18:22
• @Damian Okay that gives you a good excuse but it is bad terminology for them too. Otherwise their Biometry book is not too bad. – Michael R. Chernick Aug 15 '12 at 19:52