powered by
Roughly duplicates the following glm-style code:
glm
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, ... )
A list of raw results
The model.matrix for X (you need to create this yourself before).
The binary response vector.
"aic" (default, fast) or "pval" (slow, but possibly yields a better model).
The significance threshold to include a new variable. Default is 0.05. If mode == "aic", this argument is ignored.
0.05
mode == "aic"
Should we automatically begin with an intercept? Default is TRUE.
TRUE
Print out messages during the loop? Default is TRUE.
Parameter used in fast_logistic_regression. Default is FALSE. See documentation there.
fast_logistic_regression
FALSE
Parameter used in fast_logistic_regression. Default is 1e-7. See documentation there.
1e-7
Other arguments to be passed to fastLR. See documentation there.
fastLR
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)
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)
library(MASS); data(Pima.te) flr = fast_logistic_regression_stepwise_forward( Xmm = model.matrix(~ . - type, Pima.te), ybin = as.numeric(Pima.te$type == "Yes") )
Run the code above in your browser using DataLab