A silly example.
x1 <- as.factor(c(rep("dog", 3), rep("cat", 3), rep("mouse", 3)))
x2 <- as.factor(rep(c("happy", "sad", "angry"), 3))
x3 <- rnorm(9, 0, 1) + runif(9, 3, 5)
y <- rnorm(9, 10, 2)
Call:
lm(formula = y ~ x1 + x2 + x3)
Residuals:
1 2 3 4 5 6 7 8 9
-1.57949 1.51090 0.06859 1.59378 -2.50472 0.91094 -0.01429 0.99383 -0.97953
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 19.69066 6.98359 2.820 0.0668 .
x1dog -5.89792 3.40777 -1.731 0.1819
x1mouse -2.05016 3.32847 -0.616 0.5815
x2happy 1.57757 1.99707 0.790 0.4872
x2sad -0.02729 2.09737 -0.013 0.9904
x3 -1.83281 1.19873 -1.529 0.2237
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.336 on 3 degrees of freedom
Multiple R-squared: 0.6874, Adjusted R-squared: 0.1664
F-statistic: 1.319 on 5 and 3 DF, p-value: 0.4362
Say I wanted to know the marginal effect of a 'happy dog' on y. I would add x1dog
and x2happy
, and say something like, "compared to an angry cat, a happy dog has a -4.32 marginal effect on y."
My question is, what standard error would I give on this estimate? I don't think I should just add the two respective SE's. What is the approach?
Thanks!