How can I fit a GLM using R's glm() evaluated at specific values (e.g. median)? -
i fit generalized linear model in r, using glm()
. more precisely, it's nb.glm()
. apparently, coefficients fitted in r packages deal generalized linear models evaluated @ mean values of other variables. there way evaluate coefficients holding values of other variables constant @ e.g. median or zero?
for example, example ucla's ats site on negbin regression:
require(foreign) require(ggplot2) require(mass) dat <- read.dta("http://www.ats.ucla.edu/stat/stata/dae/nb_data.dta") dat <- within(dat, { prog <- factor(prog, levels = 1:3, labels = c("general", "academic", "vocational")) id <- factor(id) }) summary(m1 <- glm.nb(daysabs ~ math + prog, data = dat))
the resulting coefficients evaluated @ mean value of daysabs
, 5.96. find more intuitive evaluate coefficients @ median values.
Comments
Post a Comment