Description Usage Arguments Details Value Author(s) References Examples
Provides a tool for identifying whether or not separation has occurred.
1 | separation.detection(fit, nsteps = 30)
|
fit |
the result of a |
nsteps |
Starting from |
Identifies separated cases for binomial-response GLMs, by 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 resulted for
control = glm.control(maxit = 1)
. Based on the results in Lesaffre
& Albert (1989), if the sequence of ratios in any column of the
resultant matrix diverges, then separation occurs and the maximum
likelihood estimate for the corresponding parameter has value minus or
plus infinity.
A matrix of dimension nsteps
by length(coef(fit))
, that
contains the ratios of the estimated asymptotic standard errors.
Ioannis Kosmidis, i.kosmidis@ucl.ac.uk
Lesaffre, E. and Albert, A. (1989). Partial separation in logistic discrimination. J. R. Statist. Soc. B, 51, 109–116.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Begin Example
y <- c(1,1,0,0)
totals <- c(2,2,2,2)
x1 <- c(1,0,1,0)
x2 <- c(1,1,0,0)
m1 <- glm(y/totals ~ x1 + x2, weights = totals, family = binomial())
# No warning from glm...
m1
# However estimates for (Intercept) and x2 are unusually large in
# absolute value... Investigate further:
#
separation.detection(m1,nsteps=30)
# Note that the values in the column for (Intercept) and x2 diverge,
# while for x1 converged. Hence, separation has occurred and the
# maximum lieklihood estimate for (Intercept) is minus infinity and
# for x2 is plus infinity. The signs for infinity are taken from the
# signs of (Intercept) and x1 in coef(m1).
## End Example
|
Loading required package: profileModel
'brglm' will gradually be superseded by 'brglm2' (https://cran.r-project.org/package=brglm2), which provides utilities for mean and median bias reduction for all GLMs and methods for the detection of infinite estimates in binomial-response models.
Call: glm(formula = y/totals ~ x1 + x2, family = binomial(), weights = totals)
Coefficients:
(Intercept) x1 x2
-2.390e+01 -5.051e-15 2.390e+01
Degrees of Freedom: 3 Total (i.e. Null); 1 Residual
Null Deviance: 3.452
Residual Deviance: 3.33e-10 AIC: 8.773
(Intercept) x1 x2
[1,] 1.000000e+00 1.000000 1.000000e+00
[2,] 1.498944e+00 1.131802 1.422423e+00
[3,] 2.343207e+00 1.200091 2.194713e+00
[4,] 3.770512e+00 1.229147 3.523304e+00
[5,] 6.155899e+00 1.240465 5.750252e+00
[6,] 1.011152e+01 1.244720 9.444735e+00
[7,] 1.664787e+01 1.246298 1.554995e+01
[8,] 2.743356e+01 1.246880 2.562432e+01
[9,] 4.522171e+01 1.247094 4.223933e+01
[10,] 7.455279e+01 1.247173 6.963602e+01
[11,] 1.229136e+02 1.247202 1.148074e+02
[12,] 2.026484e+02 1.247213 1.892837e+02
[13,] 3.341095e+02 1.247217 3.120749e+02
[14,] 5.508528e+02 1.247218 5.145239e+02
[15,] 9.082022e+02 1.247219 8.483061e+02
[16,] 1.497372e+03 1.247219 1.398620e+03
[17,] 2.468749e+03 1.247219 2.305935e+03
[18,] 4.070279e+03 1.247219 3.801843e+03
[19,] 6.710756e+03 1.247219 6.268180e+03
[20,] 1.106417e+04 1.247219 1.033448e+04
[21,] 1.824172e+04 1.247219 1.703868e+04
[22,] 3.007552e+04 1.247219 2.809203e+04
[23,] 4.958615e+04 1.247219 4.631593e+04
[24,] 8.175374e+04 1.247219 7.636206e+04
[25,] 1.347891e+05 1.247219 1.258998e+05
[26,] 2.222297e+05 1.247219 2.075736e+05
[27,] 3.663948e+05 1.247219 3.422310e+05
[28,] 6.040830e+05 1.247219 5.642436e+05
[29,] 9.959644e+05 1.247219 9.302803e+05
[30,] 2.146846e+07 1.247219 2.005261e+07
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.