vech: Half-vectorization of a symmetric matrix

Description Usage Arguments Details Value Examples

Description

Half-vectorization of a symmetric matrix

Usage

1
vech(M)

Arguments

M

An n by n symmetric matrix.

Details

Throws an error if M is not square, but does not test if M is symmetric. Elements above the main diagonal are simply ignored.

Value

A column vector containing the vech of M, i.e. the n * (n + 1) / 2 unique elements of M.

Examples

1
2
3
4
5
M <- matrix(c(11, 12, 13, 14,
              12, 22, 23, 24,
              13, 23, 33, 34,
              14, 24, 34, 44), 4, 4, byrow = TRUE)
vech(M)

fditraglia/zoofactr documentation built on May 16, 2019, 12:12 p.m.