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 |
use_intercept |
Should we automatically begin with an intercept? Default is |
verbose |
Print out messages during the loop? Default is |
drop_collinear_variables |
Parameter used in |
lm_fit_tol |
Parameter used in |
... |
Other arguments to be passed to |
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")
)