Learn R Programming

corpcor (version 1.5.6)

mvr.shrink: Multivariate Shrinkage Regression

Description

mvr.shrink implements an analytic shrinkage approach for multivariate linear regression that can be applied for "small n, large p" data. mvr.predict is a function to predict the response given the (estimated) regression coefficients.

Usage

mvr.shrink(x, y, lambda, lambda.var, w, verbose=TRUE)
mvr.predict(coef, x)

Arguments

x
a predictor matrix.
y
a response vector or matrix. If y is missing then each individual column of x serves as univariate response vector that is regressed in turn against the remaining predictors.
lambda
the correlation shrinkage intensity (range 0-1). If lambda is not specified (the default) it is estimated using an analytic formula from Sch"afer and Strimmer (2005) - see details below. For lambda=0 the
lambda.var
the variance shrinkage intensity (range 0-1). If lambda.var is not specified (the default) it is estimated using an analytic formula from Opgen-Rhein and Strimmer (2007) - see details below.
w
optional: weights for each data point - if not specified uniform weights are assumed (w = rep(1/n, n) with n = nrow(x)).
verbose
output some status messages while computing (default: TRUE)
coef
the matrix of regression coefficients, as output by mvr.shrink().

Value

  • mvr.shrink returns a matrix with the estimated regression coefficients.

    mvr.predict returns a response matrix.

Details

Regression coefficients and partial correlations/variances are interrelated, see for example Cox and Wermuth (1993). Specifically, the regression coefficients are the partial correlations times the square-root of the ratio of the partial variances. The function mvr.shrink first computes shrinkage estimates of partial correlation and variance following the method described in Sch"afer and Strimmer (2005) and Opgen-Rhein and Strimmer (2007), and then calculates from these the respective regression coefficients. Note that if the response is multivariate, the the type of regression performed is block regression (Cox and Wermuth 1993).

References

Cox, D. R., and N. Wermuth. 1993. Linear dependencies represented by chain graphs. Statistical Science 8:204-283. Opgen-Rhein, R., and K. Strimmer. 2007. Accurate ranking of differentially expressed genes by a distribution-free shrinkage approach. Statist. Appl. Genet. Mol. Biol. 6:9. (http://www.bepress.com/sagmb/vol6/iss1/art9/)

Sch"afer, J., and K. Strimmer. 2005. A shrinkage approach to large-scale covariance estimation and implications for functional genomics. Statist. Appl. Genet. Mol. Biol. 4:32. (http://www.bepress.com/sagmb/vol4/iss1/art32/)

See Also

cov.shrink

Examples

Run this code
# load corpcor library
library("corpcor")


# example data
data(longley) 
x     = as.matrix(longley[ 1:13, -2])
y     = as.matrix(longley[ 1:13,  2, drop=FALSE]) 
xtest = as.matrix(longley[14:16, -2])
ytest = as.matrix(longley[14:16,  2, drop=FALSE]) 


# least squares regression is recovered if
# shrinkage intensities are all set to zero
lm(y ~ x)
coefs.ols = mvr.shrink(x, y, lambda=0, lambda.var=0)
coefs.ols


# shrinkage regression coefficients 
# note that these are quite different!
coefs.shrink = mvr.shrink(x, y)
coefs.shrink


# prediction
mvr.predict(coefs.ols, xtest)
mvr.predict(coefs.shrink, xtest)


# if no response matrix is given, then each predictor 
# is regressed in turn against all others
coefs = mvr.shrink(longley)
coefs


# connection between partial correlations and regression coefficients
# (note that the mvr.shrink() function is specifically constructed so that 
# this relationship holds for the shrinkage estimates)

beta = coefs[,-1]    # shrinkage regression coefficients w/o intercept
pc = pcor.shrink(longley) # shrunken partial correlations
k = 3
l = 4
# partial correlations as computed by pcor.shrink()
pc[k,l] 
# partial correlations obtained from mvr.shrink() regression coefficients 
sqrt(beta[k,l] * beta[l,k]) * sign(beta[l,k])

Run the code above in your browser using DataLab