Learn R Programming

MCMCpack (version 0.4-5)

xpnd: Expand a Vector into a Symmetric Matrix

Description

This function takes a vector of appropriate length (typically created using vech) and creates a symmetric matrix.

Usage

xpnd(x, nrow)

Arguments

x
A list of elements to expand into symmetric matrix.
nrow
The number of rows (and columns) in the returned matrix.

Value

  • An $(nrows \times nrows)$ symmetric matrix.

Details

This function is particularly useful when dealing with variance covariance matrices. Note that R stores matrices in column major order, and that the items in x will be recycled to fill the matrix if need be.

See Also

vech

Examples

Run this code
xpnd(c(1,2,3,4,4,5,6,7,8,9),4)

Run the code above in your browser using DataLab