Description Usage Arguments References Examples
This function performs a LASSO logistic regression model using a bootstrap ranking procedure.
1 | BRLasso(x, y, B = 5, Boots = 100, kfold = 10)
|
x |
the predictor matrix |
y |
the response variable, a factor object with values of 0 and 1 |
B |
the external loop for intersection operation, with the default value 5 |
Boots |
the internal loop for bootstrap sampling, with the default value 100 |
kfold |
the K-fold cross validation, with the default value 10 |
Guo, P., Zeng, F., Hu, X., Zhang, D., Zhu, S., Deng, Y., & Hao, Y. (2015). Improved Variable Selection Algorithm Using a LASSO-Type Penalty, with an Application to Assessing Hepatitis B Infection Relevant Factors in Community Residents. PLoS One, 27;10(7):e0134151.
1 2 3 4 5 6 7 8 9 10 | library(datasets)
head(iris)
X <- as.matrix(subset(iris,iris$Species!="setosa")[,-5])
Y <- as.factor(ifelse(subset(iris,iris$Species!="setosa")[,5]=='versicolor',0,1))
# Fitting a bootstrap ranking LASSO (BRLASSO) logistic regression model
BRLasso.fit <- BRLasso(x=X, y=Y, B=2, Boots=10, kfold=10)
# Variables selected by the BRLASSO model
BRLasso.fit$var.selected
# Coefficients of the selected variables
BRLasso.fit$var.coef
|
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
Loading required package: SiZer
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
Step 1-Current iteration: 1
Step 1-Current iteration: 2
Step 1-Current iteration: 3
Step 1-Current iteration: 4
Step 1-Current iteration: 5
Step 1-Current iteration: 6
Step 1-Current iteration: 7
Step 1-Current iteration: 8
Step 1-Current iteration: 9
Step 1-Current iteration: 10
Step 2-Current iteration: 1
Step 1-Current iteration: 1
Step 1-Current iteration: 2
Step 1-Current iteration: 3
Step 1-Current iteration: 4
Step 1-Current iteration: 5
Step 1-Current iteration: 6
Step 1-Current iteration: 7
Step 1-Current iteration: 8
Step 1-Current iteration: 9
Step 1-Current iteration: 10
Step 2-Current iteration: 2
[1] "Petal.Width"
Petal.Width
20.46436
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.