# Performing an ANCOVA in R to reveal significant differences of slopes

Short Summary:

1. different slopes using linear regression models for two data sets obtained from experiments with different growth conditions
2. are the slopes significantly different? --> ANCOVA in R
3. is there an effect of the different growth conditions on the magnitude of the slope?

I would like to test whether the linear regression, i.e. the slope, of the data sets from two different experiments differ significantly from each other. So far, I learned that I can test this via ANCOVA. For this purpose, I would like to use R. However, I am quite new to statistics and R in general, but you have to start somewhere I guess.

As far as I understand, ANCOVA evaluates the influence of a categorial parameter (in this case that would be different growth conditions) on the response (y-variable) of different data sets while simultaneously controlling the influence of the x-variable (covariate). However, I am stuck right now with the declaration of the data in question in R and interpreting the output. And yes, I did a lot of cross-reading on different tutorials on the internet. But, to be honest I have still not fully understand how to apply/interpret an ANCOVA in R using my data sets.

Here some details regarding the data set:

• using a normal linear regression model (each data set fitted individually), I determined the slopes of the data sets to differ by 3.5

• for the csv-inputfile, I prepared the data within three continuous colums containing all data from both sets (x-variable, y-variable and a categorial parameter [1 and 2])

• I want to test whether the difference between the slopes is significant and can be attributed to the different growth conditions of the organisms in the two experiments. That said, the categorial parameter equals the two different experimental setups

Here is my R-input:

rm(list=ls())
setwd("..........")
getwd()
results = aov(y-variable ~ x-variable * group, data = ancov)
summary(results)


R-output:

                   Df    Sum Sq   Mean Sq  F value Pr(>F)
x-variable          1 0.0005182 0.0005182 1745.824 <2e-16 ***
group               1 0.0000007 0.0000007    2.486   0.13
x-variable:group    1 0.0000125 0.0000125   42.064  2e-06 ***
Residuals          21 0.0000062 0.0000003
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


My idea for output interpretation:

1. x-variable (covariate; first line of output) has a significant effect on the response (which is somewhat apparent for me from the relationship of the x- and y-variable in a scientific context)
2. no significant effect of the categorial parameter on the response (second line) --> here, I do not get what this means in conjungtion with the next line of output
3. significant effect of the interaction between covariate and categorial parameter on the response (third line) --> as far as I got it from different online sources that means the slopes of the two data sets are indeed significantly different

In general, to me this looks like the message I wanted to obtain by this analysis: slopes are significantly different or not (in my case they are). I used an asterisk in results = aov(y-variable ~ x-variable * group, data = ancov) because I wanted to compare the slopes and not the y-intercepts (which would require a plus symbol afaik). However, as said before I am quite new to statistics and R so I would appreciate any advices regarding the interpretation of the output, further tests and ANCOVA model validation. I am especially interested in the (biological) interpretation of these results, i.e. how can a significant interaction effect between the covariate and the categorial parameter fit together with a non-significant effect of the categorial parameter on the response. Perhaps, I am missing something here or the data set might not be suitable for ANCOVA analysis?