shrink.intensity {corpcor} | R Documentation |
Estimation of Shrinkage Intensities
Description
The functions estimate.lambda
and estimate.lambda.var
shrinkage intensities used for correlations and variances used
in cor.shrink
and var.shrink
, respectively.
Usage
estimate.lambda(x, w, verbose=TRUE)
estimate.lambda.var(x, w, verbose=TRUE)
Arguments
x |
a data matrix |
w |
optional: weights for each data point - if not specified uniform weights are assumed
( |
verbose |
report shrinkage intensities (default: TRUE) |
Details
var.shrink
computes the empirical variance of each considered random variable,
and shrinks them towards their median. The corresponding
shrinkage intensity lambda.var
is estimated using
where denotes the median of the empirical variances (see Opgen-Rhein and Strimmer 2007).
Similarly, cor.shrink
computes a shrinkage estimate of the correlation matrix by
shrinking the empirical correlations towards the identity matrix.
In this case the shrinkage intensity lambda
equals
(Sch\"afer and Strimmer 2005).
Ahdesm\"aki suggested (2012) a computationally highly efficient algorithm to compute the shrinkage intensity estimate for the correlation matrix (see the R code for the implementation).
Value
estimate.lambda
and estimate.lambda.var
returns a number between 0 and 1.
Author(s)
Juliane Sch\"afer, Rainer Opgen-Rhein, Miika Ahdesm\"aki and Korbinian Strimmer (https://strimmerlab.github.io).
References
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. <DOI:10.2202/1544-6115.1252>
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. <DOI:10.2202/1544-6115.1175>
See Also
Examples
# load corpcor library
library("corpcor")
# small n, large p
p = 100
n = 20
# generate random pxp covariance matrix
sigma = matrix(rnorm(p*p),ncol=p)
sigma = crossprod(sigma)+ diag(rep(0.1, p))
# simulate multinormal data of sample size n
sigsvd = svd(sigma)
Y = t(sigsvd$v %*% (t(sigsvd$u) * sqrt(sigsvd$d)))
X = matrix(rnorm(n * ncol(sigma)), nrow = n) %*% Y
# correlation shrinkage intensity
estimate.lambda(X)
c = cor.shrink(X)
attr(c, "lambda")
# variance shrinkage intensity
estimate.lambda.var(X)
v = var.shrink(X)
attr(v, "lambda.var")