Learn R Programming

corpcor (version 1.1.2)

cov.bagged: Bagged Estimates of Covariance and (Partial) Correlation

Description

cov.bagged, cor.bagged, and pcor.bagged calculate the bootstrap aggregated (=bagged) versions of the covariance and (partial) covariance estimators.

Usage

cov.bagged(x, R=1000, ...)
cor.bagged(x, R=1000, ...)
pcor.bagged(x, R=1000, ...)

Arguments

x
data matrix or data frame
R
number of bootstrap replicates (default: 1000)
...
options passed to cov, cor, and pseudoinverse

Value

  • A symmetric matrix.

Details

Bootstrap aggregation, or ``bagging'', was first suggested by Breiman (1996) as a means to improve an estimator using the bootstrap. The bagged estimate corresponds simply to the mean of the bootstrap sampling distribution. Bagging is essentially a non-parametric variance reduction method. In Schaefer and Strimmer (2005a,b) the inverse of the bagged correlation matrix is used to estimate graphical Gaussian models from sparse microarray data.

Note that bagging is computatationally quite expensive. See cov.shrink for alternative (and better) approach to variance-reduced covariance estimation.

References

Breiman, L. (1996). Bagging predictors. Machine Learning, 24, 123--140.

Schaefer, J., and Strimmer, K. (2005a). An empirical Bayes approach to inferring large-scale gene association networks. Bioinformatics 21:754-764. Schaefer, J., and Strimmer, K. (2005b). Learning large-scale graphical Gaussian models from genomic data. Proceedings of CNET 2004, Aveiro, Pt. (AIP)

See Also

cov.shrink.

Examples

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

# some statistics on the US states
data(state)
us.states <- t(state.x77)
dim(us.states) # sample size: 8, number of variables: 50

# estimates of correlation
c <- cor(us.states)
bc <- cor.bagged(us.states)
sc <- cor.shrink(us.states)

# positive definiteness of bagged correlation and shrinkage correlation
is.positive.definite(c)
is.positive.definite(bc)
is.positive.definite(sc)

# rank and condition
rank.condition(c)
rank.condition(bc)
rank.condition(sc) # overall best!

Run the code above in your browser using DataLab