[R] Interpreting factor*numeric interaction coefficients
Matthew Carroll
mjc510 at york.ac.uk
Mon Apr 12 11:15:58 CEST 2010
Dear all,
I am a relative novice with R, so please forgive any terrible errors...
I am working with a GLM that describes a response variable as a function of
a categorical variable with three levels and a continuous variable. These
two predictor variables are believed to interact.
An example of such a model follows at the bottom of this message, but here
is a section of its summary table:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.220186 0.539475 2.262 0.0237 *
var1 0.028182 0.050850 0.554 0.5794
cat2 -0.112454 0.781137 -0.144 0.8855
cat3 0.339589 0.672828 0.505 0.6138
var1:cat2 0.007091 0.068072 0.104 0.9170
var1:cat3 -0.027248 0.064468 -0.423 0.6725
I am having trouble interpreting this output.
I think I understand that:
# the 'var1' value refers to the slope of the relationship within the first
factor level
# the 'cat2' and 'cat3' values refer to the difference in intercept from
'cat1'
# the interaction terms describe the difference in slope between the
relationship in 'cat1' and that in 'cat2' and 'cat3' respectively
Therefore, if I wanted a single value to describe the slope in either cat2
or cat3, I would sum the interaction value with that of var1.
However, if I wanted to report a standard error for the slope in 'cat2', how
would I go about doing this? Is the reported standard error that for the
overall slope for that factor level, or is the actual standard error a
function of the standard error of var1 and that of the interaction?
Any help with this would be much appreciated,
Matthew Carroll
### example code
resp <- rpois(30, 5)
cat <- factor(rep(c(1:3), 10))
var1 <- rnorm(30, 10, 3)
mod <- glm(resp ~ var1 * cat, family="poisson")
summary(mod)
Call:
glm(formula = resp ~ var1 * cat, family = "poisson")
Deviance Residuals:
Min 1Q Median 3Q Max
-1.80269 -0.54107 -0.06169 0.51819 1.58169
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.220186 0.539475 2.262 0.0237 *
var1 0.028182 0.050850 0.554 0.5794
cat2 -0.112454 0.781137 -0.144 0.8855
cat3 0.339589 0.672828 0.505 0.6138
var1:cat2 0.007091 0.068072 0.104 0.9170
var1:cat3 -0.027248 0.064468 -0.423 0.6725
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 23.222 on 29 degrees of freedom Residual deviance:
22.192 on 24 degrees of freedom
AIC: 133.75
Number of Fisher Scoring iterations: 5
--
Matthew Carroll
E-mail: mjc510 at york.ac.uk
More information about the R-help
mailing list