Generate Sample/Population Correlation/Covariance Matrices
It generates random sample or population correlation or
covariance matrices. rCor()
is a wrapper to call
rCorPop()
and then rCorSam()
.
rCor(Sigma, V, n, corr=TRUE, raw.data=FALSE, nonPD.pop=c("replace", "nearPD", "accept"), nonPD.sam=c("stop", "nearPD")) rCorPop(Sigma, V, k, corr=TRUE, nonPD.pop=c("replace", "nearPD", "accept")) rCorSam(Sigma, n, corr=TRUE, raw.data=FALSE, nonPD.sam=c("stop", "nearPD"))
Sigma |
A list of population correlation/covariance matrices or a single matrix |
V |
A variance-covariance matrix of Sigma. |
n |
A vector or a single sample sizes. |
corr |
Logical. Whether to generate correlation or covariance matrices. |
raw.data |
Logical. Whether correlation/covariance matrices are generated via raw.data or directly from a Wishart distribution. |
nonPD.pop |
If it is |
nonPD.sam |
If it is |
k |
A vector or a single number of studies. |
An object of the generated population/sample correlation/covariance matrices.
Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>
Sigma <- matrix(c(1, .2, .3, .2, 1, .4, .3, .4, 1), ncol=3, nrow=3) V <- diag(c(.1, .1, .1)) ## Generate two population correlation matrices Pop.corr <- rCorPop(Sigma, V, k=2) Pop.corr summary(Pop.corr) ## Generate two sample correlation matrices rCorSam(Sigma=Pop.corr, n=c(10, 10)) ## The above code is the same as the following one rCor(Sigma, V, n=c(10, 10))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.