fac.ar1mat | R Documentation |
Form the correlation matrix for a (generalized) factor where the correlation between the levels follows an autocorrelation of order 1 (ar1) pattern.
fac.ar1mat(factor, rho)
factor |
The (generalized) |
rho |
The correlation parameter for the ar1 process. |
The method is:
a) form an n x n
matrix of all pairwise differences in the numeric values
corresponding to the observed levels of the factor by taking the
difference between 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) replace each element of the pairwise difference matrix with rho raised to
the absolute value of the difference.
An n x n matrix
, where n is the length of the
factor
.
Chris Brien
fac.vcmat
, 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
ar1.B <- fac.ar1mat(B, 0.6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.