Covariance and Correlation

Share:

Description

sd() will compute the standard deviations of the columns, equivalent to calling apply(x, MARGIN=2, FUN=sd) (which will work for distributed matrices, by the way). However, this should be much faster and use less memory than apply(). If reduce=FALSE then the return is a distributed matrix consisting of one (global) row; otherwise, an R vector is returned, with ownership of this vector determined by proc.dest.

Usage

1
2
3
4
5
6
## S4 method for signature 'ddmatrix'
sd(x, na.rm = FALSE, reduce = FALSE,
  proc.dest = "all")

## S4 method for signature 'ANY'
sd(x, na.rm = FALSE)

Arguments

x

numeric distributed matrices.

na.rm

Logical; if TRUE, then na.exclude() is called first.

reduce

logical or string. See details

proc.dest

Destination process (or 'all') if a reduction occurs

Value

Returns a distributed matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# Save code in a file "demo.r" and run with 2 processors by
# > mpiexec -np 2 Rscript demo.r

library(pbdDMAT, quiet = TRUE)
init.grid()

x <- ddmatrix("rnorm", nrow=3, ncol=3)

cv <- cov(x)
print(cv)

finalize()

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.