dae (version 3.1-23)

fac.meanop: computes the projection matrix that produces means

Description

Computes the symmetric projection matrix that produces the means corresponding to a (generalized) factor.

Usage

fac.meanop(factor)

Arguments

factor

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

Value

A projector containing the symmetric, projection matrix and its degrees of freedom.

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 projection matrix is formed as X %*% (1/diag(r) %*% t(X), where r is the vector of levels replications.

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.

See Also

fac.combine, projector, degfree, correct.degfree, fac.sumop in package dae.

projector for further information about this class.

Examples

Run this code
# NOT RUN {
## 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 generalized 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
M.AB <- fac.meanop(AB)
# }

Run the code above in your browser using DataCamp Workspace