compressedRidge: Perform compressed (penalized) linear regression

Description Usage Arguments Value Examples

Description

Perform compressed (penalized) linear regression

Usage

1
2
3
4
compressedRidge(X, Y, compression = c("xy", "qxqy", "qxy", "linComb",
  "convexComb"), q, lam = NULL, lam.max = NULL, lam.min = 1e-06,
  nlam = 100, s = 3, tol.lam0 = 1e-08, tol.lc = 1e-10,
  div_calc_yn = TRUE)

Arguments

X

the design matrix (n x p)

Y

the response vector

compression

either none ('xy'), full compression ('qxqy'), partial compression ('qxy'), linear combination ('linComb') or the convex combination ('convexComb')

q

columns in the compression matrix

lam

optional values of the tuning parameter. Default is [lam.min, lam.max] with nlam entries equally spaced on the log scale

lam.max

defaults to the maximum L1-norm of the covariates divided by 1e-3

lam.min

defaults to 1e-6, unless the smallest singular value is larger than tol, in which case 0 is included

nlam

number of lambda values, default is 100, 101 if 0 is included

s

1/s is the probability of non-zero entries in the compression matrix, default is 3

tol.lam0

determines how close to singular the design can be and still try to use lam=0. Ignored if lam is given. Compares with the smallest singular value of the design.

tol.lc

determines how close to singular the matrix of fitted values can be. Compares with the smallest singular value. Default is then a 50-50 combination of qxy and qxqy.

Value

A list with components of class 'cplr':

intercept

a vector of length nlam containing the intercept

bhat

a matrix of size p x nlam containing the estimated coefficients

bhatsc

a matrix of size p x nlam containing the scaled, estimated coefficients. For use with the plot method.

fitted

a matrix of size n x nlam containing fitted values

residuals

a matrix of size n x nlam containing residuals

GCV

The generalized cross validation score for model selection.

lam

The sequence of lam values used. Either generated or user supplied.

df

The degrees of freedom of the procedure. If full or partial compression, this is the trace of the smoothing matrix. For the other cases, the procedure is not a linear smoother, but rather a weighted sum of two linear smoothers. In that case, this value is simply the weighted sum of the two linear procedures. Note that this likely underestimates the true degrees of freedom.

train

The training error for each value of lam

Examples

1
2
3
4
5
6
n = 100
p = 5
q = 50
X = generateX(n, diag(1,p), 'rnorm')
Y = generateY(X, p:1, 'rnorm')
out = compressedRidge(X, Y, 'linComb', q=q, lam.max=1)

dajmcdon/cplr documentation built on May 14, 2019, 3:29 p.m.