Logistic regression with multiple predictors

This is a convenient interface to the glm function that performs a logistic regression for one or multiple predictors and displays the results graphically. It handles continuous and categorical predictors as well as their interaction.

IQRlogisticRegression(
  data,
  VARcol,
  PREDcol,
  IDcol = "ID",
  PREDinteraction = NULL,
  PREDval = NULL,
  FLAGintercept = TRUE,
  formula = NULL,
  ci.level = 0.95,
  FLAGfirth = FALSE,
  refValuesPlot = NULL,
  xlab = NULL,
  ylab = NULL,
  pathname = NULL,
  FLAGreport = TRUE,
  SIGNIF = 4
)

Arguments

data

A data frame containing the columns that are defined in the following.

VARcol

Name of the column in data that contains the information about an event happened (1) or not (0).

PREDcol

Name(s) of the column in data that should be used as a predictor.

IDcol

Name of the column with subject IDs (only for annotation purpose).

PREDinteraction

Character vector with comma separated predictor names for which an interaction term is included. Only second order interactions are considered.

PREDval

Named vector with coefficients of numerical predictors that should be fixed (categorical are not handled yet). The intercept can be fixed by using the name 'Intercept' for the respective value. Second order interactions can be fixed by the two predictor names separated by comma. Note that the order needs to be the same as given in PREDinteraction or the formula.

FLAGintercept

Flag whether to include intercept (defaults to TRUE)

formula

Formula or string to define the model for glm. If given (not NULL) the arguments VARcol, PREDcol, PREDinteraction, and FLAGintercept are ignored

ci.level

Confidence interval level (between 0 an 1, defaults to 0.95)

FLAGfirth

Flag whether to Firth's bias-reduced penalized log-likelihood

refValuesPlot

Reference values to which predictors are fixed when plotting predictions along range for others.

xlab

Label for the x-axis.

ylab

Label for the y-axis.

pathname

If given, path to which results are written.

FLAGreport

Whether to produce report ready table with estimates.

SIGNIF

Number of significant digits used for the displayed values.

Value

IQRlogisticFit object: Main output is a table with estimation results. Attributes to the output argument contain a data frame with the estimates, a data frame with predicted individual probabilities, the glm fit object, and plots with predicted probability along each predictor as well as the individual probability