covMatrix | R Documentation |
C++ implementation to compute the covariance matrix for a (sparse) input matrix. The function is equivalent to the R command 'cov' applied to matrices.
covMatrix(m, useCpp = TRUE, sparse = TRUE)
m |
A (sparse) matrix for which the covariance matrix is sought. The input matrix is assumed to be oriented to contain the data for one individual per column. |
useCpp |
Flag to switch between R or C++ implementations. Default is |
sparse |
Flag to switch between purpose-built dense or sparse implementations. Default is |
The covariance matrix of m
.
R Core Team (2014). R: A Language and Environment for Statistical Computing. R Foundation for Stat Comp, Vienna, Austria.
require(locStra) require(Matrix) m <- matrix(sample(0:1,15,replace=TRUE),ncol=3) sparseM <- Matrix(m,sparse=TRUE) print(covMatrix(sparseM))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.