bolasso: bolasso: A package for variable selection via bolasso...

Description Usage Arguments Value Author(s) Examples

View source: R/fit-interface.R

Description

This package provides implementation of bolasso to select variables. This is done via bootsrapping the training set and running a lasso in every bootstrap sample. Then, only variables that appear in most of the bootstrap samples are selected and a ridge is trained with those variables

bolasso() applies bolasso to dataset. Bolasso is a feature selection technique that applies lasso for feature to different bootstrap samples of the dataset, and then keeps the features that are selection most of the time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
bolasso(x, ...)

## Default S3 method:
bolasso(x, ...)

## S3 method for class 'data.frame'
bolasso(x, y, ...)

## S3 method for class 'matrix'
bolasso(x, y, ...)

## S3 method for class 'formula'
bolasso(formula, data, ...)

## S3 method for class 'recipe'
bolasso(x, data, ...)

Arguments

x

Depending on the context:

  • A data frame of predictors.

  • A matrix of predictors.

  • A recipe specifying a set of preprocessing steps created from recipes::recipe().

...

Most importantly, n_bootstraps, threshold_selection, and ... of cv.glmnet.

y

When x is a data frame or matrix, y is the outcome specified as:

  • A data frame with 1 numeric column.

  • A matrix with 1 numeric column.

  • A numeric vector.

formula

A formula specifying the outcome terms on the left-hand side, and the predictor terms on the right-hand side.

data

When a recipe or formula is used, data is specified as:

  • A data frame containing both the predictors and the outcome.

Value

A bolasso object.

Author(s)

Maintainer: David Masip david26694@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
predictors <- mtcars[,c("mpg", "disp", "hp", "drat", "wt")]
outcome <- mtcars[, "vs"]

# XY interface
mod <- bolasso(predictors, outcome)

# Formula interface
mod2 <- bolasso(vs ~ ., mtcars)

# Recipes interface
library(recipes)
rec <- recipe(mpg ~ ., mtcars)
rec <- step_log(rec, disp)
mod3 <- bolasso(rec, mtcars)

david26694/bolasso documentation built on Nov. 4, 2019, 9:43 a.m.