fac.sumop {dae}R Documentation

computes the summation matrix that produces sums corresponding to a (generalized) factor

Description

Computes the matrix that produces the sums corresponding to a (generalized) factor.

Usage

fac.sumop(factor)

Arguments

factor

The (generalized) factor whose sums the summation matrix computes from an observation-length vector.

Details

The design matrix X for a (generalized) factor is formed with a column for each level of the (generalized) factor, this column being its indicator variable. The summation matrix is formed as X %*% t(X).

A generalized factor is a factor formed from the combinations of the levels of several original factors. Generalized factors can be formed using fac.combine.

Value

A symmetric matrix.

Author(s)

Chris Brien

See Also

fac.combine, fac.meanop in package dae.

Examples

## set up a two-level factoir 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 generlaized factor whose levels are the combinations of A and B
AB <- fac.combine(list(A,B))

## obtain the operator that computes the AB means from a vector of length 12
S.AB <- fac.sumop(AB)

[Package dae version 3.2.25 Index]