# Comparing slopes between different regression lines in the same sample

I have two models:

mod1 <- glm(y ~ A + CONTROL1 + CONTROL2, data = dat,family=binomial(link="logit"))
mod2 <- glm(y ~ B + CONTROL1 + CONTROL2, data = dat,family=binomial(link="logit"))

I'm trying to determine if slope A in mod1 is significantly different from slope B in mod2.

I'll give a reproducible example here:

mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")
mydata\$sat<-rnorm(400, mean=1350, sd=100) # randomly generate SAT scores
m1 <- glm(admit ~ gre + gpa + rank, data = mydata, family = "binomial")
m2 <- glm(admit ~ sat + gpa + rank, data = mydata, family = "binomial")

I am interested in finding out if the slope associated with gre in m1 is significantly different from the slope associated with sat in m2.

What are some tests in R that can help me get there?

• Possible duplicate of stats.stackexchange.com/questions/252325/…. Especially the first comment and the corresponding link. Feb 19 '19 at 19:08
• I'm not sure if it's a duplicate. The questions in the two threads are quite a bit different. I'm not asking about how slopes might vary by subgroups. Feb 19 '19 at 19:13
• That's why I indicated they are possible -- admittedly they may not apply -- I just scanned them because I remember a similar question before. I guess one question I'd have is why are you fitting separate models? Can you update the question a bit to tell us why you are doing separate models as opposed to fitting a single model with an interaction term? Feb 19 '19 at 19:17
• Thanks for your follow up. I'm not fitting a single model with an interaction term because there's no theoretical reason for doing so. In the example, there's no reason to think that the effect of "gre" on the likelihood of admittance varies by "sat" scores. I'm only trying to see if there's a different effect between "gre" and "sat" on the outcome variable. m1 and m2 aren't nested models. Feb 19 '19 at 19:21
• Have you tested that theory? Couldn't you just include gre and sat in the same model and test contrasts? It seems you'd want to account for both of these since both influence admission. I'm not sure you can have one without the other in any admission process that I know of. Feb 19 '19 at 19:25

Simply test your GRE model on a hold-out sample of data and compute the mean squared predicted error (MSPE). Do the same thing with the SAT model. Then, select the model that has the lowest mean squared predicted error as this model does the best job of predicting. You could even perform cross-validation or jackknife estimates with these methods and compare the averaged MSPEs.