detectseparation (version 0.1)

check_infinite_estimates.glm: A simple diagnostic of whether the maximum likelihood estimates are infinite

Description

A simple diagnostic of whether the maximum likelihood estimates are infinite

Usage

# S3 method for glm
check_infinite_estimates(object, nsteps = 20, ...)

Arguments

object

the result of a glm call.

nsteps

starting from maxit = 1, the GLM is refitted for maxit = 2, maxit = 3, …, maxit = nsteps. Default value is 30.

...

currently not used.

Value

An object of class inf_check that has a plot method.

A matrix inheriting from class inf_check, with nsteps rows and p columns, where p is the number of model parameters. A plot method is provided for inf_check objects for the easy inspection of the ratios of the standard errors.

Details

check_infinite_estimates attempts to identify the occurence of infinite estimates in GLMs with binomial responses by successively refitting the model. At each iteration the maximum number of allowed IWLS iterations is fixed starting from 1 to nsteps (by setting control = glm.control(maxit = j), where j takes values 1, …, nsteps in glm). For each value of maxit, the estimated asymptotic standard errors are divided to the corresponding ones from control = glm.control(maxit = 1). Then, based on the results in Lesaffre & Albert (1989), if the sequence of ratios in any column of the resultant matrix diverges, then complete or quasi-complete separation occurs and the maximum likelihood estimate for the corresponding parameter has value minus or plus infinity.

References

Lesaffre, E., & Albert, A. (1989). Partial Separation in Logistic Discrimination. *Journal of the Royal Statistical Society. Series B (Methodological)*, **51**, 109-116

Kosmidis I. and Firth D. (2019). Jeffreys-prior penalty, finiteness and shrinkage in binomial-response generalized linear models. arXiv:1812.01938. https://arxiv.org/abs/1812.01938v3

See Also

multinom, detect_separation, brmultinom

Examples

Run this code
# NOT RUN {
## endometrial data from Heinze \& Schemper (2002) (see ?endometrial)
data("endometrial", package = "detectseparation")
endometrial_ml <- glm(HG ~ NV + PI + EH, data = endometrial,
                      family = binomial("probit"))
## clearly the maximum likelihood estimate for the coefficient of
## NV is infinite
(estimates <- check_infinite_estimates(endometrial_ml))
plot(estimates)


# }
# NOT RUN {
## Aligator data (Agresti, 2002, Table~7.1)
if (requireNamespace("brglm2", quietly = TRUE)) {
    data("alligators", package = "brglm2")
    all_ml <- brglm2::brmultinom(foodchoice ~ size + lake , weights = round(freq/3),
                         data = alligators, type = "ML", ref = 1)
    ## Clearly some estimated standard errors diverge as the number of
    ## Fisher scoring iterations increases
    plot(check_infinite_estimates(all_ml))
    ## Bias reduction the brglm2 R packages can be used to get finite estimates
    all_br <- brglm2::brmultinom(foodchoice ~ size + lake , weights = round(freq/3),
                         data = alligators, ref = 1)
    plot(check_infinite_estimates(all_br))
}
# }

Run the code above in your browser using DataLab