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))

Details

For more usage examples and more information on glm models, see the Introducing chantrics vignette by running vignette("chantrics-vignette", package = "chantrics")

Also works for MASS::glm.nb(), note that the standard errors of the theta are not adjusted.

References

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.

Examples

# 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)
#> #> Call: #> glm(formula = participation ~ . + I(age^2), family = binomial(link = "probit"), #> data = SwissLabor) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -1.9191 -0.9695 -0.4792 1.0209 2.4803 #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 3.74909 1.40695 2.665 0.00771 ** #> income -0.66694 0.13196 -5.054 4.33e-07 *** #> age 2.07530 0.40544 5.119 3.08e-07 *** #> education 0.01920 0.01793 1.071 0.28428 #> youngkids -0.71449 0.10039 -7.117 1.10e-12 *** #> oldkids -0.14698 0.05089 -2.888 0.00387 ** #> foreignyes 0.71437 0.12133 5.888 3.92e-09 *** #> I(age^2) -0.29434 0.04995 -5.893 3.79e-09 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for binomial family taken to be 1) #> #> Null deviance: 1203.2 on 871 degrees of freedom #> Residual deviance: 1017.2 on 864 degrees of freedom #> AIC: 1033.2 #> #> Number of Fisher Scoring iterations: 4 #>
swiss_probit_adj <- adj_loglik(swiss_probit) summary(swiss_probit_adj)
#> MLE SE adj. SE #> (Intercept) 3.7490 1.40700 1.32700 #> income -0.6669 0.13200 0.12730 #> age 2.0750 0.40540 0.39860 #> education 0.0192 0.01793 0.01793 #> youngkids -0.7145 0.10040 0.10610 #> oldkids -0.1470 0.05089 0.05161 #> foreignyes 0.7144 0.12130 0.12240 #> I(age^2) -0.2943 0.04995 0.04953
# == logit == swiss_logit <- glm(participation ~ . + I(age^2), data = SwissLabor, family = binomial(link = "logit") ) summary(swiss_logit)
#> #> Call: #> glm(formula = participation ~ . + I(age^2), family = binomial(link = "logit"), #> data = SwissLabor) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -1.9061 -0.9627 -0.4924 1.0171 2.3915 #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 6.19639 2.38309 2.600 0.00932 ** #> income -1.10409 0.22571 -4.892 1.00e-06 *** #> age 3.43661 0.68789 4.996 5.86e-07 *** #> education 0.03266 0.02999 1.089 0.27611 #> youngkids -1.18575 0.17202 -6.893 5.46e-12 *** #> oldkids -0.24094 0.08446 -2.853 0.00433 ** #> foreignyes 1.16834 0.20384 5.732 9.94e-09 *** #> I(age^2) -0.48764 0.08519 -5.724 1.04e-08 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for binomial family taken to be 1) #> #> Null deviance: 1203.2 on 871 degrees of freedom #> Residual deviance: 1017.6 on 864 degrees of freedom #> AIC: 1033.6 #> #> Number of Fisher Scoring iterations: 4 #>
swiss_logit_adj <- adj_loglik(swiss_logit) summary(swiss_logit_adj)
#> MLE SE adj. SE #> (Intercept) 6.19600 2.38300 2.29300 #> income -1.10400 0.22570 0.22140 #> age 3.43700 0.68790 0.67240 #> education 0.03266 0.02999 0.02996 #> youngkids -1.18600 0.17200 0.18180 #> oldkids -0.24090 0.08446 0.08584 #> foreignyes 1.16800 0.20380 0.20570 #> I(age^2) -0.48760 0.08519 0.08384