tr: Matrix trace

View source: R/tr.R

trR Documentation

Matrix trace

Description

Calculates the trace of a matrix

Usage

tr(M)

Arguments

M

a matrix

Details

For square, symmetric matrices, such as covariance matrices, the trace is sometimes used as a measure of size, e.g., in Pillai's trace criterion for a MLM.

Value

returns the sum of the diagonal elements of the matrix

Author(s)

Michael Friendly

Examples


M <- matrix(sample(1:9), 3,3)
tr(M)


friendly/mvinfluence documentation built on Sept. 28, 2022, 10:05 a.m.