Learn R Programming

paleomorph (version 0.1.4)

dotcvm: Calculate 2d or 3D covariance matrix using unscaled congruence coefficient. Skips any missing values in computation of covariance matrix

Description

Calculate 2D or 3D covariance matrix using unscaled congruence coefficient. Skips any missing values in computation of covariance matrix

Usage

dotcvm(A)

Arguments

A
An N x D x M array where N is the number of landmarks, D is the number of dimensions (2 or 3), and M is the number of specimens.

Value

N x N covariance matrix

Details

This function does not guarantee that the returned matrix is positive definite. If the covariance matrix is not positive definite a warning is given and the matrix can be bent to create the closest positive definite matrix with as.matrix(Matrix::nearPD(mat)$mat).

Examples

Run this code
A <- array(rnorm(4 * 2 * 3), dim = c(2, 3, 4)) 
A.cvm <- dotcvm(A)

Run the code above in your browser using DataLab