# 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