xpnd | R Documentation |
This function takes a vector of appropriate length (typically created using
vech
) and creates a symmetric matrix.
xpnd(x, nrow = NULL)
x |
A list of elements to expand into symmetric matrix. |
nrow |
The number of rows (and columns) in the returned matrix. Look into the 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.
The number of rows can be specified or automatically computed from the
number of elements in a given object via (-1 + \sqrt{(1 + 8 *
length(x))}) / 2
.
An (nrows \times nrows)
symmetric matrix.
vech
xpnd(c(1,2,3,4,4,5,6,7,8,9),4)
xpnd(c(1,2,3,4,4,5,6,7,8,9))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.