# NOT RUN {
## endometrial data from Heinze \& Schemper (2002) (see ?endometrial)
data("endometrial", package = "detectseparation")
endometrial_sep <- glm(HG ~ NV + PI + EH, data = endometrial,
family = binomial("logit"),
method = "detect_separation")
endometrial_sep
## The maximum likelihood estimate for NV is infinite
summary(update(endometrial_sep, method = "glm.fit"))
# }
# NOT RUN {
## Example inspired by unpublished microeconometrics lecture notes by
## Achim Zeileis https://eeecon.uibk.ac.at/~zeileis/
## The maximum likelihood estimate of sourhernyes is infinite
if (requireNamespace("AER", quietly = TRUE)) {
data("MurderRates", package = "AER")
murder_sep <- glm(I(executions > 0) ~ time + income +
noncauc + lfp + southern, data = MurderRates,
family = binomial(), method = "detect_separation")
murder_sep
## which is also evident by the large estimated standard error for NV
murder_glm <- update(murder_sep, method = "glm.fit")
summary(murder_glm)
## and is also reveal by the divergence of the NV column of the
## result from the more computationally intensive check
plot(check_infinite_estimates(murder_glm))
## Mean bias reduction via adjusted scores results in finite estimates
if (requireNamespace("brglm2", quietly = TRUE))
update(murder_glm, method = brglm2::brglm_fit)
}
# }
Run the code above in your browser using DataCamp Workspace