glm:
Fitting Generalized Linear Models
Description
This function overloads the glm
function so that a check for the existence of the maximum likelihood estimate is computed before fitting a glm with a binary response.
Usage
glm(formula, family = gaussian, data, weights, subset, na.action, start = NULL,
etastart, mustart, offset, control = glm.control(...), model = TRUE,
method = "glm.fit", x = FALSE, y = TRUE, contrasts = NULL, ...,
separation = c("find", "test"))
Arguments
separation
either find or test. Both options prevent the model from being fit to binary data when the maximum likelihood estimate does not exist. Additionally, when separation = "find"
, the terms separating the sample points are identified when the maximum likelihood estimate is found not to exist.
Value
See the return value for the glm
function.
Details
This function checks for the existence of the maximum likelihood estimate before the glm function is used to fit binary regression models by solving the linear program proposed in Konis (2007).
Examples
## A set of 4 completely separated sample points ##
x <- c(-2, -1, 1, 2)
y <- c(0, 0, 1, 1)
## Not run: glm(y ~ x, family = binomial)
## A set of 4 quasicompletely separated sample points ##
x <- c(-2, 0, 0, 2)
y <- c(0, 0, 1, 1)
## Not run: glm(y ~ x, family = binomial)