fac.vcmat | R Documentation |
Form the variance matrix for a (generalized) factor whose effects for its different levels are independently and identically distributed, with their variance given by the variance component; elements of the matrix will equal either zero or sigma2 and displays compound symmetry.
fac.vcmat(factor, sigma2)
factor |
The (generalized) |
sigma2 |
The variance component, being the of the random effects for the factor. |
The method is: a) form the n x n summation or relationship matrix whose elements are equal to zero except for those elements whose corresponding elements in the following two n x n matrices are equal: 1) each row contains the numeric values corresponding to the observed levels of the factor, and 2) each column contains the numeric values corresponding to the observed levels of the factor, b) multiply the summation matrix by sigma2.
An n x n matrix
, where n is the length of the
factor
.
Chris Brien
fac.ar1mat
, fac.meanop
,
fac.sumop
in package dae.
## set up a two-level factor and a three-level factor, both of length 12
A <- factor(rep(1:2, each=6))
B <- factor(rep(1:3, each=2, times=2))
## create a 12 x 12 ar1 matrix corrresponding to B
vc.B <- fac.vcmat(B, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.