Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

covar

Covariance


Description

An optimized, efficient implemntation for computing covariance.

Usage

covar(x, y, use = "everything", inplace = FALSE, inverse = FALSE)

tcovar(x, y, use = "everything", inplace = FALSE, inverse = FALSE)

Arguments

x

A numeric dataframe/matrix or vector.

y

A vector (when x is a vector) or missing (blank) when x is a matrix.

use

The NA handler, as in R's cov() and cor() functions. Options are "everything", "all.obs", and "complete.obs".

inplace

Logical; if TRUE then the method used is slower but uses less memory than if FALSE. See ?coop-package for details.

inverse

Logical; should the inverse covariance matrix be returned?

Details

See ?coop-package for implementation details.

Value

The covariance matrix.

Author(s)

Drew Schmidt

See Also

Examples

x <- matrix(rnorm(10*3), 10, 3)

coop::pcor(x)
coop::pcor(x[, 1], x[, 2])

coop

Co-Operation: Fast Covariance, Correlation, and Cosine Similarity Operations

v0.6-2
BSD 2-clause License + file LICENSE
Authors
Drew Schmidt [aut, cre], Christian Heckendorf [ctb] (Caught some memory errors.)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.