Solved – How to test whether linear models fit separately to two groups are better than a single model applied to both groups

interactionlinear modelregression

My question is how to tell if two regressions explain the data better than one.

Let me be more concrete with an example (which I'm making up as I go, it's not meant to be plausible). Say I'm interested in the relationship between income and happiness. Then I ask a lot of people about their income and happiness. But say some of the people I ask are men and some are women. Now, I perform a linear regression for income and happiness and see that income does predict happiness according to some coefficients, it's significant, the model explains a lot of the variance, etc.

My question is, how do I test whether there's a unique relationship between happiness and income, that applies across men and women, or the data are better explained by two models, each obtained by regressing separately on men and women?

I'm thinking of calculating residuals for the data with respect to each model, then comparing the sum of the residuals, or something along those lines. Is that a reasonable thing to do? How would I go about comparing the residuals?

So, in summary, how do I know if the better hypothesis is that of one unique linear model for all the data, or the one where each subset (subsets defined a priori) of the data has its own linear model?

Best Answer

If you are conducting studies to deepen your theoretical understanding of some topic, this is a great thing to wonder about. Fortunately, there are well-developed statistical methods for assessing this question. What you do is fit both a full model that encompasses the possibility that the relationship differs between men and women, and a reduced model that assumes there is no such difference. Then you perform a nested model test.

The way to make a model that allows for there to be a differing relationship by sex is to include an interaction term in addition to variables for income and sex. Here is what such a model would look like:
$$ \text{Happiness}=\beta_0 + \beta_1\text{Income} + \beta_2\text{Sex} + \beta_3\text{Income}\times\text{Sex} + \varepsilon $$ Note that sex would be represented by a dummy code, that is, a vector of $1$s and $0$s, where the $1$s indicated, e.g., that the person was a man. The reduced model would look like this:
$$ \text{Happiness}=\beta_0 + \beta_1\text{Income} + \varepsilon $$ Thus, the models differ in two parameters, and the larger model 'reduces' to the smaller one if $\beta_2=\beta_3=0$. To simultaneously test whether both parameters are 0, you perform a nested model test. (I have discussed such tests here: Testing for moderation with continuous vs categorical moderators, albeit in a different context.)

If you decide to keep the larger model, the implication is that the relationship between income an happiness for women is:
$$ \text{Happiness}=\beta_0 + \beta_1\text{Income} + \varepsilon $$ And the relationship for men is:
$$ \text{Happiness}=\underbrace{(\beta_0 + \beta_2)}_{\text{intercept}} + \underbrace{(\beta_1+\beta_3)}_{\text{slope}}\text{Income} + \varepsilon $$ (Again, this assumes that men are $1$, and women are $0$.)