Fits a univariate logistic regression model for a binary outcome and a categorical predictor. Returns odds ratios (OR), 95% confidence intervals, Wald p-values for 2-level predictors, and likelihood ratio test (LRT) p-values for predictors with >2 categories.

logist_univar_fun(data_fun, response, var)

Arguments

data_fun

Data frame containing variables.

response

Character. Name of the binary outcome variable (0/1).

var

Character. Name of the categorical predictor.

dig

Integer. Number of digits for rounding OR and CI. Default = 2.

Value

A character matrix with rows = levels of the variable and columns = "OR (95% CI)" and "p value".

Details

• Removes incomplete cases using only the variables in response and var. • For categorical predictors with:

  • 2 levels → Wald p-value for the coefficient

  • >2 levels → Likelihood ratio test (LRT) comparing model vs. intercept-only model

Examples

if (FALSE) { # \dontrun{
logist_univar_fun(mydata, response = "Y", var = "Gender")
} # }