fast_logistic_regression_stepwise_forward {fastLogisticRegressionWrap}R Documentation

Rapid Forward Stepwise Logistic Regression

Description

Roughly duplicates the following glm-style code:

Usage

fast_logistic_regression_stepwise_forward(
  Xmm,
  ybin,
  mode = "aic",
  pval_threshold = 0.05,
  use_intercept = TRUE,
  verbose = TRUE,
  drop_collinear_variables = FALSE,
  lm_fit_tol = 1e-07,
  ...
)

Arguments

Xmm

The model.matrix for X (you need to create this yourself before).

ybin

The binary response vector.

mode

"aic" (default, fast) or "pval" (slow, but possibly yields a better model).

pval_threshold

The significance threshold to include a new variable. Default is 0.05. If mode == "aic", this argument is ignored.

use_intercept

Should we automatically begin with an intercept? Default is TRUE.

verbose

Print out messages during the loop? Default is TRUE.

drop_collinear_variables

Parameter used in fast_logistic_regression. Default is FALSE. See documentation there.

lm_fit_tol

Parameter used in fast_logistic_regression. Default is 1e-7. See documentation there.

...

Other arguments to be passed to fastLR. See documentation there.

Details

nullmod = glm(ybin ~ 0, data.frame(Xmm), family = binomial) fullmod = glm(ybin ~ 0 + ., data.frame(Xmm), family = binomial) forwards = step(nullmod, scope = list(lower = formula(nullmod), upper = formula(fullmod)), direction = "forward", trace = 0)

Value

A list of raw results

Examples

library(MASS); data(Pima.te)
flr = fast_logistic_regression_stepwise_forward(
  Xmm = model.matrix(~ . - type, Pima.te), 
  ybin = as.numeric(Pima.te$type == "Yes")
)

[Package fastLogisticRegressionWrap version 1.2.0 Index]