covariance: Covariance and Correlation

Description Usage Arguments Details Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'ddmatrix'
cov(x, y = NULL, use = "everything", method = "pearson")

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

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

## S4 method for signature '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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

RBigData/pbdDMAT documentation built on Oct. 29, 2021, 6:20 p.m.