# computes the projection matrix that produces means

### Description

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

.

### Usage

1 |

### Arguments

`factor` |
The (generalized) |

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

.

### Value

A `projector`

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

### Author(s)

Chris Brien

### See Also

`fac.combine`

, `projector`

, `degfree`

,
`correct.degfree`

, `fac.sumop`

in package dae.

`projector`

for further information about this class.

### Examples

1 2 3 4 5 6 7 8 9 | ```
## 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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.