covFamily: Marginal covariance matrix

Description Usage Arguments Details Value Note Author(s)

Description

Various workhorse functions to compute the marginal (or unconditional) covariance (and cross-covariance) estimates. The functions feature both the maximum likelihood and the biased corrected estimates. They are (almost) equivalent implementations of cov (stats::cov) in Rcpp, RcppArmadillo, and RcppEigen.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
covRcpp(X, norm_type = 0L)

xcovRcpp(X, Y, norm_type = 0L)

covArma(X, norm_type = 0L)

xcovArma(X, Y, norm_type = 0L)

covEigen(X, norm_type = 0L)

xcovEigen(X, Y, norm_type = 0L)

Arguments

X

A numeric matrix.

norm_type

an integer of length one giving the estimator. The default 0L gives the unbiased estimate while 1L gives the MLE.

Y

A numeric matrix of compatible dimension with the X, i.e. nrow(X) equals nrow(Y).

Details

Functions almost like cor. For the xcorXX functions, the i'th and j'th entry of the output matrix is the correlation between X[i, ] and X[j, ]. Likewise, for the xcorXX functions, the i'th and j'th entry of the output is the correlation between X[i, ] and Y[j, ].

Value

The cor-family returns a numeric correlation matrix of size ncol(X) times ncol(X).

The xcor-family returns a numeric cross-covariance matrix of size ncol(X) times ncol(Y).

Note

NAs in X or Y will yield NAs in the correlation matrix. This also includes the diagonal unlike the behavior of stats::cor(X).

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>


AEBilgrau/correlateR documentation built on Nov. 15, 2019, 9:21 a.m.