cov: Covariance Matrix Calculation for (Potentially Grouped) Data

Description Usage Arguments Details Value Examples

View source: R/cov.R

Description

Covariance Matrix Calculation for (Potentially Grouped) Data

Usage

1
cov(x, ..., covEst = stats::cov)

Arguments

x

data you would like the covariance matrix of. The parameter x can be a data.frame, grouped_df, resample, or matrix.

...

other options passed to covarince estimation method

covEst

covariance or precision matrix estimation method, as a function. Defaults to stats::cov.

Details

This function has the capability to calculate total and group-level covariance and precision matrices estimated from the given data. Specify group membership with the group = "COLNAME" syntax. Additionally, this function returns objects with an additional class: when this function returns group-level lists of matrices, each covariance or precision matrix will have the R classes matrix and covariance; likewise, total covariance or precision matrices are also returned with the classes matrix and covariance. Moreover, these matrices have an additional named attribute: df, for degrees of freedom. The computational functionality of the covariance class will be explored in future updates.

Value

list of matries with class covariance by group. These matrices may be covariance or precision matrices, depending on the function supplied to the covEst argument.

Examples

1
2
3
cov(iris[,1:4])
cov(iris, group = "Species")
cov(iris[,1:4], covEst = Haff_shrinkage)

BenBarnard/covEst documentation built on May 5, 2019, 2:40 p.m.