
Confidence intervals for logistic regression coefficients
Source:R/logistic_regression.R
confint.logistic_regression.RdConfidence intervals for the coefficients B (log-odds scale) of a
logistic_regression model.
The default method = "wald" gives Wald intervals
(\(B \pm z_{1-\alpha/2} \cdot SE\)), the interval SPSS LOGISTIC
REGRESSION reports as "95\
summary() prints: exp(confint(model)) reproduces the
Lower/Upper columns of the coefficients table. method = "profile"
gives the profile-likelihood intervals of stats::confint() for
glm objects.
Value
A matrix with one row per coefficient and columns for the lower and upper limits (log-odds scale).
Examples
survey_data$high_satisfaction <- as.integer(survey_data$life_satisfaction >= 4)
model <- logistic_regression(survey_data, high_satisfaction ~ age + gender)
confint(model) # Wald (SPSS)
#> 2.5 % 97.5 %
#> (Intercept) 0.043750737 0.5762897
#> age -0.006071836 0.0034194
#> genderFemale -0.032012673 0.2909808
exp(confint(model)) # SPSS "95% C.I. for EXP(B)"
#> 2.5 % 97.5 %
#> (Intercept) 1.0447219 1.779424
#> age 0.9939466 1.003425
#> genderFemale 0.9684943 1.337739