glm {chantrics} | R Documentation |
In a generalised linear model (glm), the user can choose between a range of
distributions of a response y
, and can allow for non-linear relations
between the mean outcome for a particular combination of covariates x
,
E(y_i\mid x_i)=\mu_i
, and the linear predictor,
\eta_i=x_i^T\beta
, which is the link function g(\mu_i)=\eta_i
.
it is required to be monotonic. (For a quick introduction, see
Kleiber and Zeileis (2008, Ch. 5.1), for more complete coverage of the
topic, see, for example, Davison (2003, Ch. 10.3))
For more usage examples and more information on glm
models, see the
Introducing chantrics
vignette by running
vignette("chantrics-vignette", package = "chantrics")
gaussian
poisson
binomial
MASS::negative.binomial
Also works for MASS::glm.nb()
, note that the standard errors of the theta
are not adjusted.
Davison, A. C. 2003. Statistical Models. Cambridge Series on Statistical and Probabilistic Mathematics 11. Cambridge University Press, Cambridge.
Kleiber, Christian, and Achim Zeileis. 2008. Applied Econometrics with R. Edited by Robert Gentleman, Kurt Hornik, and Giovanni Parmigiani. Use r! New York: Springer-Verlag.
# binomial example from Applied Econometrics in R, Kleiber/Zeileis (2008)
# == probit ==
data("SwissLabor", package = "AER")
swiss_probit <- glm(participation ~ . + I(age^2),
data = SwissLabor,
family = binomial(link = "probit")
)
summary(swiss_probit)
swiss_probit_adj <- adj_loglik(swiss_probit)
summary(swiss_probit_adj)
# == logit ==
swiss_logit <- glm(participation ~ . + I(age^2),
data = SwissLabor,
family = binomial(link = "logit")
)
summary(swiss_logit)
swiss_logit_adj <- adj_loglik(swiss_logit)
summary(swiss_logit_adj)