Learn R Programming

lmreg (version 1.2)

tr: Trace of matrix

Description

Computes the trace of a given matrix.

Usage

tr(M)

Arguments

M

A matrix whose trace is to be computed.

Value

A scalar value, describing the trace of M.

References

Sengupta and Jammalamadaka (2019), Linear Models and Regression with R: An Integrated Approach.

Examples

Run this code
# NOT RUN {
tr(matrix(2,2,2))
# }

Run the code above in your browser using DataLab