covariance

0th

Percentile

Covariance and Correlation

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

Keywords
methods
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.

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.

Value

Returns a distributed matrix.

Aliases
  • covariance
  • cov,ddmatrix-method
  • var,ddmatrix-method
  • cor,ddmatrix-method
  • cov2cor,ddmatrix-method
Examples
# 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)

# }
Documentation reproduced from package pbdDMAT, version 0.5-1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.