tr | R Documentation |
Calculates the trace of a matrix
tr(M)
M |
a matrix |
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.
returns the sum of the diagonal elements of the matrix
Michael Friendly
M <- matrix(sample(1:9), 3,3) tr(M)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.