# planor.harmonize: Harmonize the Factors In planor: Generation of Regular Factorial Designs

## Description

Harmonize the factors originating from a list of factors, a list of models, and a list of basic factors (this function is essentially for internal use).

## Usage

 ```1 2``` ```planor.harmonize(factors, nlevels, ordered, hierarchy, model, estimate, listofmodels, base) ```

## Arguments

 `factors` an object of class `designfactors`, typically an output from `planor.factors`). Otherwise the arguments `factors`, `nlevels`, `ordered`, `hierarchy` follow the syntax of `planor.factors`. `nlevels` see `planor.factors`. Ignored if `factors` is of class `designfactors`. `ordered` see `planor.factors`. Ignored if `factors` is of class `designfactors`. `hierarchy` see `planor.factors`. Ignored if `factors` is an object of class `designfactors`. `model` a list of model-estimate pairs of formulae, typically an output from `planor.model`. Otherwise the arguments `model`, `estimate` and `listofmodels` follow the syntax of `planor.model`. `estimate` see `planor.model`. Ignored if `model` is a list. `listofmodels` see `planor.model`. Ignored if `model` is a list. `base` an optional formula to specify the basic factors. These factors must belong to the `factors` argument

## Value

An object of class `designfactors` very similar to `factors`, but with two additional logical columns in slots `fact.info` and `pseudo.info`:
- `model` (TRUE for the factors present in at least one model formula),
- `basic` (TRUE for the basic factors).

## Note

This function is called at the start of the design search. It is essentially a check that the factors in all three arguments are coherent, even though it performs some additional tasks. The function stops if it detects a model or basic factor that is absent from `factors`. This is because the number of levels of such a factor is unknown and so the design search cannot proceed. Besides, the function eliminates the factors that do appear neither in `model` nor in `base` and it reorders the factors by putting first the basic ones.

## Author(s)

Monod, H. and Bouvier, A.

## Examples

 ```1 2 3 4 5``` ```F2 <- planor.factors(factors=c("block",LETTERS[1:4]), nlevels=c(6,6,6,4,2)) M2 <- planor.model( model=~block+(A+B+C)^2, estimate=~A+B+C ) F2.h <- planor.harmonize(factors=F2, model=M2, base=~A+B) names(F2) names(F2.h) ```

planor documentation built on March 19, 2020, 1:06 a.m.