I have the following model: $y \sim b_0 + b_1x_1 + b_2x_2 + b_3x_1x_2$.
$x_1$ is a factor with 2 levels (0 and 1), and $x_2$ is a factor with 3 levels.
I know that to calculate standard errors for the interaction term I should use $\sqrt{\text{var}(b_1) + \text{var}(b_2) + 2\text{cov}(b_1,b_2)}$.
When I use vcov() in R to get the variance/covariance matrix I get a 6x6 matrix with the following column/row names:
- (Intercept)
- factor(x1)level1
- factor(x2)level1
- factor(x2)level2
- factor(x1)level1:factor(x2)level1
- factor(x1)level1:factor(x2)level2.
Where on this matrix is the cov(b1,b2)? Is it in the cell [factor(x1)level1, factor(x2)level1] or in the cell [factor(x1)level1,factor(x2)level2] or neither?
Or to put it better, if I want the standard errors for the marginal effects of x1 and x2 on y, how do I calculate them? When we have more than 2 levels in a factor does the above mentioned standard error equation change?
Many thanks in advance!
EDIT (migrated from OP answer): Maybe I should rephrase: I need the standard error for the marginal effect of x1 on y and the standard error for the marginal effect of x2 on y. the equation I put there supposedly gives that standard error (please see in this website How to calculate the interaction standard error of a linear regression model in R? and in Brambor T. et al Understanding Interaction Models: Improving Empirical Analyses. Political Analysis (2006) 14:63–82. doi:10.1093/pan/mpi014, equation 8). But maybe I am not using the correct terminology or references here? any ideas on how to calculate that standard error would be very wellcome.
R. The statistical content concerns how to extend the paper's analysis from binary factors to n-ary factors. – whuber Aug 27 '12 at 13:45marginscommand, so there is no question of how to compute the standard error of the marginal effect unless you want to verify the formula.) The "multilevel" tag question still remains. – StasK Aug 27 '12 at 14:30