# Covariance matrix of the estimates when there is interaction

Consider a factorial design with two treatments A and B. Four possible cases are: administer none of them, administer A, administer B and administer both.

By introducing indicator variables $I_A$ and $I_B$ specifying whether treatment A or B, respectively has been administered, we define following linear model for the response variable:

$Y_i = \beta_0+\beta_1 I_{Ai}+\beta_2 I_{Bi}+\beta_3 I_{Ai}I_{Bi}+\epsilon_i$

where $i=1,...,N$, $\epsilon_i \sim N(0,\sigma^2)$, and $Cov(\epsilon_i,\epsilon^*_i)$. For simplicity, let's assume that each option was sampled $N/4$ times.

If $\beta_3=0$, meaning that there is no interaction term: define design matrix $X$. The maximum likelihood estimator can be found as $\boldsymbol{\hat{\beta}} = (X^T X)^{-1}X^TY$, and the variance matrix of the estimates is $Cov(\boldsymbol{\hat{\beta}}) = \sigma^2 (X^T X)^{-1}$. The treatment effect of none is $\beta_0$, A is $\beta_0+\beta_1$, B is $\beta_0+\beta_2$ and A&B is $\beta_0+\beta_1+\beta_2$. Using $Cov(\boldsymbol{\hat{\beta}})$, we can calculate the covariance between these linear combinations of the coefficients.

Can we make a similar analysis when $\beta_3 \neq 0$?

If effect of treatment means its estimate, there is no difference between general covariates and the interaction. You can treat the interaction term as another covariate. GLM theory has no special limitation on design matrix. With interaction, your design matrix $X$ is Nx4 matrix. The estimated covariance matrix (4x4) is $var(\hat \beta) = \hat σ^2(X'X)^{-1}$. Then you can test/estimate anything that can be expressed as $L\beta$, where $L$ is kx4 matrix.
• I think I understand what you mean. However, there is a variance-covariance matrix of the estimates of these parameters. If there was not an interaction term, this covariance matrix can be calculated as $\sigma^2(X^T X)^{-1}$ where $X$ is the design matrix. And once we know the covariance between estimates, we can calculate the covariance between linear combinations of these. What I am wondering if there is a similar analysis that can be done if there is an interaction term. I will clarify my question as well. – marvinthemartian May 16 '17 at 17:14
• See the part I added in Answer. Answer to your last question is YES. But you need $\hat \sigma^2$. – user158565 May 17 '17 at 2:05