Description Usage Arguments Details Value References Examples
This function performs a Bolasso logistic regression model and produces an optimal set of predictors.
1 | Bolasso(x, y, BM = 100, kfold = 10, seed = 0123)
|
x |
predictor matrix. |
y |
response variable, a factor object with values of 0 and 1. |
BM |
the number of bootstrapping, with the default value 100. |
kfold |
the number of folds of cross validation - default is 10. Although kfold can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets. Smallest value allowable is kfold=3. |
seed |
the seed for random sampling, with the default value 0123. |
This function runs the LASSO logistic regression model using several bootstrap samples of the original data, and then intersects the non-zero coefficients for estimating consistent coefficients. A specific value of BM parameter should be supplied, however BM=100 is proposed by default. Users can reduce the running time by using 3-fold CV, but the proposed 10-fold CV is assumed by default.
BM |
the number of bootstrapping in this procedure. |
var.selected |
significant variables that are selected by the Bolasso model. |
[1] Friedman, J., Hastie, T. and Tibshirani, R. (2008). Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, 33(1), 1-22.
[2] Bach, F.R. (2008). Bolasso: model consistent lasso estimation through the bootstrap. Proceedings of the 25th international conference on Machine learning. ACM. pp. 33:40.
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))
# Fit a Bolasso logistic regression model
# The BM parameter in the following example is set as small value to reduce
# the running time, however the default value is proposed
Bolasso.fit <- Bolasso(x=X, y=Y, BM=5, seed=0123)
# Significant variables that are selected by the Bolasso model
Bolasso.fit$var.selected
|
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
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
Boostrap 1 :
Sepal.Length Sepal.Width Petal.Length Petal.Width
Boostrap 2 :
Sepal.Width Petal.Length Petal.Width
Boostrap 3 :
Sepal.Length Sepal.Width Petal.Length Petal.Width
Boostrap 4 :
Sepal.Length Sepal.Width Petal.Length Petal.Width
Boostrap 5 :
Sepal.Length Sepal.Width Petal.Length Petal.Width
Boostrap 1 :
Sepal.Length Sepal.Width Petal.Length Petal.Width
Boostrap 2 :
Sepal.Width Petal.Length Petal.Width
Boostrap 3 :
Sepal.Width Petal.Length Petal.Width
Boostrap 4 :
Sepal.Width Petal.Length Petal.Width
Boostrap 5 :
Sepal.Width Petal.Length Petal.Width
[1] "Sepal.Width" "Petal.Length" "Petal.Width"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.