sparse_proj: Sparse projections using the square-root Lasso

Description Usage Arguments Value References See Also Examples

View source: R/projections.R

Description

Regresses each column of x against all others in turn, using the square-root Lasso, and outputs residuals from the regressions. Thus it outputs a form of sparse projection of each column on all others. Alternatively, given two matrices x_null and x_alt, it regresses each column of x_null on x_alt in a similar fashion.

Usage

1
sparse_proj(x, x_null, x_alt, mc.cores = 1L, rescale = FALSE, ...)

Arguments

x

Matrix with each row an observation vector. Need not be supplied if x_alt and x_null are given.

x_null

Matrix whose columns are to be regressed on to x_alt.

x_alt

Matrix which the columns of x_null are regressed on to. Must be specified if x_null is given.

mc.cores

The number of cores to use. Will always be 1 in Windows.

rescale

Should the columns of the output be rescaled to have l_2-norm the square-root of the number of observations? Default is FALSE.

...

Additional arguments to be passed to sqrt_lasso.

Value

A matrix where each column gives the residuals.

References

A. Belloni, V. Chernozhukov, and L. Wang. (2011) Square-root lasso: pivotal recovery of sparse signals via conic programming. Biometrika, 98(4):791-806.

T. Sun and C.-H. Zhang. (2012) Scaled sparse linear regression. Biometrika, 99(4):879-898.

T. Sun and C.-H. Zhang. (2013) Sparse matrix inversion with scaled lasso. The Journal of Machine Learning Research, 14(1):3385-3418.

See Also

sqrt_lasso and RPtest_single.

Examples

1
2
x <- matrix(rnorm(50*100), 50, 100)
out <- sparse_proj(x)

Example output



RPtests documentation built on July 11, 2021, 1:06 a.m.

Related to sparse_proj in RPtests...