fac.ar1mat {dae}R Documentation

forms the ar1 correlation matrix for a (generalized) factor

Description

Form the correlation matrix for a (generalized) factor where the correlation between the levels follows an autocorrelation of order 1 (ar1) pattern.

Usage

fac.ar1mat(factor, rho)

Arguments

factor

The (generalized) factor for which the correlation between its levels displays an ar1 pattern.

rho

The correlation parameter for the ar1 process.

Details

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.

Value

An n x n matrix, where n is the length of the factor.

Author(s)

Chris Brien

See Also

fac.vcmat, fac.meanop, fac.sumop in package dae.

Examples

## 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)

[Package dae version 3.2.21 Index]