pbdDMAT (version 0.5-0)

covariance: Covariance and Correlation

Description

cov() and var() form the variance-covariance matrix. cor() forms the correlation matrix. cov2cor() scales a covariance matrix into a correlation matrix.

Usage

# S4 method for ddmatrix
cov(x, y = NULL, use = "everything",
  method = "pearson")

# S4 method for ddmatrix var(x, y = NULL, na.rm = FALSE, use)

# S4 method for ddmatrix cor(x, y = NULL, use = "everything", method = "pearson")

# S4 method for ddmatrix cov2cor(V)

Arguments

x, y, V

numeric distributed matrices.

use

character indicating how missing values should be treated. Acceptable values are the same as R's, namely "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".

method

character argument indicating which method should be used to calculate covariances. Currently only "spearman" is available for ddmatrix.

na.rm

logical, determines whether or not NA's should be dealth with.

Value

Returns a distributed matrix.

Details

cov() forms the variance-covariance matrix. Only method="pearson" is implemented at this time.

var() is a shallow wrapper for cov() in the case of a distributed matrix.

cov2cor() scales a covariance matrix into a correlation matrix.

Examples

Run this code
# NOT RUN {
spmd.code = "
library(pbdDMAT, quiet = TRUE)
init.grid()

x <- ddmatrix('rnorm', nrow=3, ncol=3), bldim=2

cv <- cov(x)
cv

finalize()
"

pbdMPI::execmpi(spmd.code = spmd.code, nranks = 2L)

# }

Run the code above in your browser using DataLab