sparse_proj {RPtests} | R Documentation |
Sparse projections using the square-root Lasso
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
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_null |
Matrix whose columns are to be regressed on to |
x_alt |
Matrix which the columns of |
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 |
... |
Additional arguments to be passed to |
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
x <- matrix(rnorm(50*100), 50, 100)
out <- sparse_proj(x)