# matrix-op: vech and other matrix operators In sn: The Skew-Normal and Related Distributions Such as the Skew-t

## Description

vech and other matrix operators

## Usage

 ```1 2 3``` ```vech(A) vech2mat(v) duplicationMatrix(n) ```

## Arguments

 `A` a (symmetric) square matrix. `v` a numeric vector such that `length(v)=n*(n+1)/2` for some positive integer `n`. `n` a positive integer number; default is `n=1`.

## Value

a vector in case of `vech`, otherwise a matrix.

## Details

For a square matrix `A`, `vech(A)` returns the vector formed by the lower triangular portion of the matrix, including the diagonal; usually, this only makes sense for a symmetric matrix of numeric values. If `v=vech(M)` where `M` is a symmetric numeric matrix, `vect2mat(v)` performs the inverse operation and returns `M`; this explain the requirement on `length(v)`. For a positive integer `n`, `D=duplicationMatrix(n)` is a matrix of dimension `(n^2, n*(n+1)/2)` such that `D %*% vech(M)` returns the `vec`-form of a symmetric matrix `M` of order `n`, that is, the vector which stacks the columns of `M`; for more information, see Section 3.8 of Magnus and Neudecker (1988).

## Author

Adelchi Azzalini; the original Octave code of `duplicationMatrix` is by Kurt Hornik.

## References

Magnus, Jan R. and Neudecker, Heinz (1988). Matrix differential calculus with application in statistics and econometrics. Wiley series in probability and statistics.

## Examples

 ```1 2 3 4 5``` ```M <- toeplitz(1:4) v <- vech(M) vech2mat(v) - M D <- duplicationMatrix(ncol(M)) # D %*% vech(M) - as.vector(M) ```

sn documentation built on Nov. 23, 2017, 1:04 a.m.