reduce.dim: Reduce Dimensionality

Description Usage Arguments Value Examples

View source: R/reduce.dim.R

Description

Reduce the dimensionality (i.e., the column number) of a design matrix to a desired level using Lasso.

Usage

1
reduce.dim(fit, X, bound)

Arguments

fit

The fitted cross validation object generated by glmnet::cv.glmnet.

X

An input design matrix whose column number is the dimensionality to be reduced.

bound

The targeted number of dimensionality after reducing.

Value

A list of (1) index.X, indices of selected columns in the design matrix; (2) sub.X, indices of selected columns in the design matrix.

Examples

1
2
3
4
5
6
set.seed(10)
X <- matrix(rnorm(100), nrow = 10)
Y <- matrix(rnorm(10), nrow = 10)
set.seed(11)
cvob1 <- glmnet::cv.glmnet(X, Y)
tmp <- reduce.dim(fit = cvob1, X = X, bound = 3)

KOBT documentation built on Feb. 20, 2020, 5:08 p.m.