Comparing slopes for 2 datasets - ANCOVA or something else? [migrated]
I am looking to determine whether two slopes (linear model) are statistically significantly different (p-value) from one another. Inserted is a graph showing the data and below is a toy version of the data that I am working with:
Age<-as.data.frame(c(50,60,70,50,60,70))
Sex<-as.data.frame(c("Male","Male","Male","Female","Female","Female"))
Strength<-as.data.frame(c(50,40,30,45,35,25))
data<-cbind(Age,Sex,Strength)
colnames(data)<-c("Age","Sex","Strength")
To me it would seem that the dependent variable is Strength (continuous), which is determined by an interaction between Age (continuous) and Sex (categorical). In such a scenario, should I be using ANCOVA to test for a significant difference between the two slopes? Any thoughts would be appreciated. Thank you.
I think there's a pretty simple way to check for this using dummies and interaction terms, without needing a separate statistical test. Just run OLS using the following regression specification:
$strength_i = \alpha+\beta_1*Age_i + \beta_2*Male_i + \beta_3*Male_i*Age_i$
where $Male_i$ is a dummy equal to 1 if Male and 0 if Female.
Subsequently $\beta_2$ will give you a "level" effect of being Male on Strength, and $\beta_3$ will give you the interaction term (it will specifically answer your question whether the slopes are different for men and women). The significance of these terms will tell you if there is a statistically significant effect in either direction.