Description Usage Arguments Details Value Examples
Fits different types of models for binary classification to a training subset of data, and then computes fit metrics over a test subset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | bc_estimate(type, dat, control = NULL)
is.bc_estimate(x)
## S3 method for class 'bc_estimate'
coef(x, int = FALSE, sig = T)
## S3 method for class 'bc_estimate'
subset(x, train = F, metric = "AUC")
## S3 method for class 'bc_estimate'
levels(x)
## S3 method for class 'bc_estimate'
dimnames(x)
## S3 method for class 'bc_estimate'
print(x, digits = 2, metric = "AUC")
## S3 method for class 'bc_estimate'
features(x)
|
type |
The type of fitting algorithm. Options
include |
dat |
An R object of class |
control |
An optional list of additional estimation parameters. |
The control argument is a list that can supply any
of the following components:
col_sel = An index for the subset of predictors to use;
second_pass = Logical; if TRUE, refits a
glm model with only the significant predictors;
prev_fit = Allows previous output from glm or
glmnet to be passed in;
error_rate = The cutoff for determining whether a
variable is statistically significant or not;
prev_coef = An optional vector with previous coefficients
to use as offsets in a null model for glm;
alpha = The mixing proportion ridge (0) versus lasso (1)
regression;
nfolds = The number of folds for cross-validation step to
select the best penalty term for glmnet;
costf = The type of cost function to use for the
cv.glmnet function, where options include 'auc' (Area
under the curve), 'mae' (mean absolute error), 'class'
(misclassification error), and 'deviance'.
The method subset can extract the specified fit metric for
either the training (train = TRUE) or test subsets. The
features method extracts the labels for the predictors
deemed significant.
An R object of class 'bc_estimate'.
1 2 3 4 5 6 7 | # Simulate data
sim = bc_simulate( 300, 8, 4 )
# Create training and test data
index = cv_index( 3, 300 )
dat = train_test( 3, index, sim$y, sim$X )
fit = bc_estimate( 'glm', dat )
fit_2 = bc_estimate( 'glmnet', dat )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.