I would like to test the difference between two independent regression coefficients. David C. Howell's book 'Statistical Methods for Psychology' (Chapter 9.11) suggests that there is a t-test for differences between two independent regression coefficients.
How would this be done in R?

I currently have these 2 regressions looking at peoples Importance to Donate based on their Guilt, Percieved Responsibility and Negative Feelings:

aov_Individual <- aov(AV_importance_to_donate~AV_guilty+AV_percieved_resp+feeling_I)

aov_Statistical <- aov(AV_importance_to_donate~AV_guilty+newdata_S$AV_percieved_resp+feeling_S)

I believe I can extract the coefficients with the following code:


But I do not know how to preform the t-test to compare the coefficients from there...

  • 1
    $\begingroup$ Not exactly what you are asking, but if you use a Bayesian regression, it’s direct and trivial to compare coefficients. $\endgroup$
    – Wayne
    Aug 6, 2019 at 20:47
  • 1
    $\begingroup$ Why did you fit two models? because of two different groups of people? because of different meaning of feeling_I and feeling_S? $\endgroup$
    – user158565
    Aug 7, 2019 at 1:58
  • $\begingroup$ Hi @user158565 , yes, i fit two models because I split the two different conditions. Specifically, the first model represents the participants that viewed a photo of an individual whilst the second model represents participants who viewed a photo of a group of people $\endgroup$
    – Maria
    Aug 7, 2019 at 7:49
  • 1
    $\begingroup$ @Maria That's not a reason to have two model. Fit one model where these two different conditions are encoded as a factor variable and you get the desired comparison automatically due to default treatment contrasts. $\endgroup$
    – Roland
    Aug 7, 2019 at 12:26
  • $\begingroup$ A t-test in this instance is inappropriate because (a) the use of the same responses in both models implies the model coefficients are not independent but (b) because the models are separately fit, involving different explanatory variables, you don't have the information needed to estimate the covariances among the estimates. To do that, you need to make both models special instances of a larger model that subsumes them both, but it's unclear exactly how to do that in your case without more information about the experiment and your assumptions. $\endgroup$
    – whuber
    Aug 7, 2019 at 14:11

1 Answer 1


rbind your two data sets (i.e. put them under each other), add your two types as new column, run aov with interactions. The interactions compare coefficients in the same model (as suggested by Roland and whuber in the comments):

mydata <- rbind(individualData, statisticalData)
# make new column for factor "individual" or "statistical":
mydata$indstat <- rep(c("ind", "stat"), each=c(nrow(individualData), nrow(statisticalData))
summary(aov(AV_importance_to_donate ~ (AV_guilty+AV_percieved_resp+feeling_I + feeling_S)*indstat, data=mydata))

You will now get the main effects for each of your predictors in the brackets, the main effect of "indstat" as well as the interactions of each of them with "indstat".

When the interaction is significant, your two data sets differ with respect to that coefficient.

(Note that you use newdata_S$AV_percieved_resp which seems to be a different variable. Obviously you can interpret interactions only if the predictors mean the same thing. Also note that you now have feeling_S and feeling_I in the model, although it is only one of the each in the original.)

(I have difficulties finding such examples on CV to point to, although there must by now be hundreds of them.)

  • $\begingroup$ You missed feeling_S in your program. $\endgroup$
    – user158565
    Aug 7, 2019 at 18:12
  • $\begingroup$ @user158565: Right you are! I edited the answer (code and the note in the first parentheses). Thanks for pointing this out. $\endgroup$
    – Carsten
    Aug 14, 2019 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.