fac.meanop {dae} | R Documentation |
Computes the symmetric projection matrix that produces the means
corresponding to a (generalized) factor
.
fac.meanop(factor)
factor |
The (generalized) |
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
.
A projector
containing the symmetric, projection matrix
and its degrees of freedom.
Chris Brien
fac.combine
, projector
, degfree
,
correct.degfree
, fac.sumop
in package dae.
projector
for further information about this class.
## 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)