1

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:

Graph

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.

PhelsumaFL
  • 11
  • 1
  • Your issue is strength of male vs strength of female. Since the age between the two groups is constant, there is no age bias, hence no need to adjust for age. A simple anova would suffice. Otherwise, if age was different, then you would have had to carry out ancova to adjust for the age bias – KU99 Jan 17 '22 at 20:38

1 Answers1

1

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.

smsarkar
  • 88
  • 5
  • +1 This is an ANCOVA with an interaction, and the hypothesis test of the $\beta_3$ coefficient can be phrased in terms of a t-test or, equivalently, an F-test. – Dave Jan 18 '22 at 19:48
  • Thank you all for your help. So I have repurposed some code from https://stats.stackexchange.com/questions/33013/what-test-can-i-use-to-compare-slopes-from-two-or-more-regression-models as follows `library(emmeans) library(lsmeans) temp1 – PhelsumaFL Jan 19 '22 at 12:52
  • I am not familiar with the approach you laid out, so I can't vouch for it. If you want to implement my solution, the code should look like this: `reg – smsarkar Jan 19 '22 at 22:49
  • Thank you very much smsarkar. I used both codes and they gave exactly the same p-value, so are clearly doing the same thing. One question: what is the p-value for the interaction term actually signifying? Whether the lines are parallel (non-significant) or not (significant)? I tried the same test with a subset of the data and got a non-significant p-value for Age*Sex even though the lines are clearly not identical (i.e., Male average Strength much higher across all ages); so is the non-significant p-value telling me that there is no Age*Sex interaction, and that Sex explains the difference? – PhelsumaFL Jan 24 '22 at 13:12