pstructure.formula {dae} | R Documentation |

`pstructure.object`

that includes the orthogonalized projectors for the terms in a formulaConstructs a `pstructure.object`

that includes a
set of mutually orthogonal projectors, one for each
term in the formula. These are used to specify a structure,
or an orthogonal decomposition of the data space.
There are three methods available for
orthogonalizing the projectors corresponding to the terms
in the `formula`

: `differencing`

, `eigenmethods`

or the default `hybrid`

method.

It is possible to use this function to find out what sources are associated with the terms in a model and to determine the marginality between terms in the model. The marginality matrix can be saved.

```
## S3 method for class 'formula'
pstructure(formula, keep.order = TRUE, grandMean = FALSE,
orthogonalize = "hybrid", labels = "sources",
marginality = NULL, check.marginality = TRUE,
omit.projectors = FALSE,
which.criteria = c("aefficiency","eefficiency","order"),
aliasing.print = TRUE, data = NULL, ...)
```

`formula` |
An object of class |

`keep.order` |
A |

`grandMean` |
A |

`orthogonalize` |
A |

`labels` |
A |

`marginality` |
A square The entry in the ith row and jth column will be one if the
ith term is marginal to the jth term i.e. the column space of the
ith term is a subspace of that for the jth term and so the source
for the jth term is to be made orthogonal to that for the ith term.
Otherwise, the entries are zero. A row and column should not be
included for the grand mean even if |

`check.marginality` |
A |

`omit.projectors` |
A |

`which.criteria` |
A character |

`aliasing.print` |
A |

`data` |
A data frame contains the values of the factors and variables
that occur in |

`...` |
further arguments passed to |

Firstly, the primary projector
`\mathbf{X(X'X)^-X'}`

, where X is the design
matrix for the term, is calculated for each term. Then each
projector is made orthogonal to terms aliased with it, either
by `differencing`

, `eigenmethods`

or the default
`hybrid`

method.

`Differencing`

relies on
comparing the factors involved in two terms, one previous to the
other, to identify whether to subtract the orthogonalized projector
for the previous term from the primary projector of the other. It
does so if factors/variables for the previous term are a subset of
the factors/variablesfor for the other term. This relies on ensuring that all
projectors whose factors/variables are a subset of the current
projector occur before it in the expanded formula. It is checked that
the set of matrices are mutually orthogonal. If they are not then
a warning is given. It may happen that differencing does not produce
a projector, in which case `eigenmethods`

must be used.

`Eigenmethods`

forces each projector to be orthogonal
to all terms previous to it in the expanded formula. It uses
equation 4.10 of James and Wilkinson (1971), which involves
calculating the canonical efficiency factors for pairs of primary
projectors. It produces a
table of efficiency criteria for partially aliased terms. Again,
the order of terms is crucial. This method has the disadvantage that
the marginality of terms is not determined and so sources names are set
to be the same as the term names, unless a `marginality`

matrix
is supplied.

The `hybrid`

method is the most general and uses the relationships
between the projection operators for the terms in the `formula`

to decide which projectors to subtract and which to orthogonalize using
eigenmethods. If `\mathbf{Q}_i`

and `\mathbf{Q}_j`

are
two projectors for two different terms, with `i < j`

, then

if

`\mathbf{Q}_j\mathbf{Q}_i \neq \mathbf{0}`

then have to orthogonalize`\mathbf{Q}_j`

to`\mathbf{Q}_i`

.if

`\mathbf{Q}_j\mathbf{Q}_i = \mathbf{Q}_j`

then, if`\mathbf{Q}_i = \mathbf{Q}_j`

, they are equal and`\mathbf{Q}_j`

will be removed from the list of terms; otherwise they are marginal and`\mathbf{Q}_i`

is subtracted from`\mathbf{Q}_j`

.if have to orthogonalize and

`\mathbf{Q}_j\mathbf{Q}_i = \mathbf{Q}_i`

then`\mathbf{Q}_j`

is aliased with previous terms and will be removed from the list of terms; otherwise`\mathbf{Q}_i`

is partially aliased with`\mathbf{Q}_j`

and`\mathbf{Q}_j`

is orthogonalized to`\mathbf{Q}_i`

using eigenmethods.

Again, the order of terms is crucial in this process.

Chris Brien

James, A. T. and Wilkinson, G. N. (1971) Factorization of the
residual operator and canonical decomposition of nonorthogonal
factors in the analysis of variance. *Biometrika*, **58**, 279-294.

`proj2.efficiency`

, `proj2.combine`

, `proj2.eigen`

,
`projs.2canon`

in package dae,

`eigen`

.

`projector`

for further information about this class.

```
## PBIBD(2) from p. 379 of Cochran and Cox (1957) Experimental Designs.
## 2nd edn Wiley, New York
PBIBD2.unit <- list(Block = 6, Unit = 4)
PBIBD2.nest <- list(Unit = "Block")
trt <- factor(c(1,4,2,5, 2,5,3,6, 3,6,1,4, 4,1,5,2, 5,2,6,3, 6,3,4,1))
PBIBD2.lay <- designRandomize(allocated = trt,
recipient = PBIBD2.unit,
nested.recipients = PBIBD2.nest)
## manually obtain projectors for units
Q.G <- projector(matrix(1, nrow=24, ncol=24)/24)
Q.B <- projector(fac.meanop(PBIBD2.lay$Block) - Q.G)
Q.BP <- projector(diag(1, nrow=24) - Q.B - Q.G)
## manually obtain projector for trt
Q.T <- projector(fac.meanop(PBIBD2.lay$trt) - Q.G)
##compute intrablock efficiency criteria
effic <- proj2.efficiency(Q.BP, Q.T)
effic
efficiency.criteria(effic)
##obtain projectors using pstructure.formula
unit.struct <- pstructure(~ Block/Unit, data = PBIBD2.lay)
trt.struct <- pstructure(~ trt, data = PBIBD2.lay)
##obtain combined decomposition and summarize
unit.trt.p2canon <- projs.2canon(unit.struct$Q, trt.struct$Q)
summary(unit.trt.p2canon, which = c("aeff","eeff","order"))
```

[Package *dae* version 3.2-13 Index]