This is a concept in regression I have never been able to understand.
Suppose we have this model with an interaction term:
$$y = b_0 + b_1 \cdot \text{{age}} + b_2 \cdot \text{{gender}} + b_3 \cdot (\text{{age}} \cdot \text{{gender}})$$
where gender is a binary variable (1 for male and 0 for female).
Case 1: When fitting this model via OLS on the entire dataset, this will actually produce 2 mini models:
- For males (gender = 1):
$$y = b_0 + b_1 \cdot \text{{age}} + b_2 + b_3 \cdot \text{{age}}$$
$$y = (b_0' + b_2') + (b_1' + b_3') \cdot \text{{age}}$$
- For females (gender = 0):
$$y = b_0'' + b_1'' \cdot \text{{age}}$$
Case 2: Now, suppose we remove all males from the data and fit the model. Then, we remove all females from the data and fit the model again. The two resulting models will be:
- For males:
$$y = b_{0m} + b_{1m} \cdot \text{{age}}$$
- For females:
$$y = b_{0f} + b_{1f} \cdot \text{{age}}$$
For me, the paradox has always been trying to understand that: the model for Males in Case 1 is the same as for Males in Case 2, and the model for Females in Case 1 is the same for Females in Case 2 (i.e. the parameter estimates are the same). That is:
$$(b_0' + b_2') = b_{0m}$$ $$(b_1' + b_3') = b_{1m}$$ $$b_0'' = b_{0f}$$ $$b_1'' = b_{1f}$$
$$Var(b_0' + b_2') = Var(b_{0m})$$ $$Var(b_1' + b_3') = Var(b_{1m})$$ $$Var(b_0'') = Var(b_{0f})$$ $$Var(b_1'') = Var(b_{1f})$$
I have heard many intuitive explanations that try to logic out why this is true, but I have never been satisfied with these explanations. Therefore, I tried to write the estimating equations (based on either OLS or MLE) to try and see that if the estimating equations are same for Case 1 and Case 2, then the parameter estimates should also be the same for Case 1 and Case 2. (paradox)
I know that in OLS, the following estimating equations hold for linear regression ($n$ is the number of data points, $p$ is the number of predictor variables):
$$\hat{y} = \mathbf{x}^T \hat{\beta}$$ $$\hat{B} = (X'X)^{-1}X'Y$$ $$Var(\hat{\beta}) = \hat{\sigma}^2 (X'X)^{-1}$$ $$\hat{\sigma} = \sqrt{\frac{1}{n - p}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2}$$
And we can write the likelihood for this regression model as :
$$ L(\beta | y, X) = \prod_{i=1}^{n} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(y_i - (b_0 + b_1 \cdot \text{{age}}_i + b_2 \cdot \text{{gender}}_i + b_3 \cdot (\text{{age}}_i \cdot \text{{gender}}_i)))^2}{2\sigma^2}\right) $$
But it is still not clear to me that the estimates from Case 1 will be the same as the estimates from Case 2. Is it possible to see that only from the estimating equations perspective (OLS or MLE), is it possible to see that the parameter estimates and variance of the parameter estimates will be identical whether estimated from Case 1 or Case 2?
Note 1: (My attempt at) Variance Derivation for OLS
$$ (AB)^T = B^T A^T $$
$$ (A^{-1})^T = (A^T)^{-1} $$
$$ (A^T)^T = A $$
$$\begin{align*} \text{Var}(\hat{B}) &= (X^tX)^{-1} X^t \text{Var}(y) [(X^tX)^{-1} X^t]^T \\ &= \hat{\sigma}^2 (X^tX)^{-1} X^t [(X^t)^t ((X^tX)^{-1})^t] \\ &= \hat{\sigma}^2 (X^tX)^{-1} X X ((X^tX)^t)^{-1} \\ &= \hat{\sigma}^2 (X^tX)^{-1} X X (X^tX)^{-1} \\ &= \hat{\sigma}^2 (X^tX)^{-1} (X^tX) (X^tX)^{-1} &=\hat{\sigma}^2 (X'X)^{-1} \end{align*}$$
- Note 2: In the absence of an interaction term, Case 1 (fitting the model on the entire dataset) and Case 2 (fitting the model on each gender separately) will produce different estimates for the slopes and intercepts (i.e. paradox does not happen):
$$y = b_0 + b_1 \cdot \text{{age}} + b_2 \cdot \text{{gender}} $$