nauf_model.matrix: Create a fixed effects model matrix using 'nauf' contrasts. In nauf: Regression with NA Values in Unordered Factors

Description

`nauf_model.matrix` creates a model matrix which employs `nauf_contrasts` for unordered factors.

Usage

 `1` ```nauf_model.matrix(object = NULL, data = NULL, ...) ```

Arguments

 `object` A `nauf.frame` or a regression formula. See 'Details'. `data` A `nauf.frame` or a `data.frame` containing the variables in `object` if `object` is a regression formula. See 'Details'. `...` Further arguments to be passed to `nauf_model.frame` when `object` is a regression formula and `data` is a `data.frame`. See 'Details'.

Details

Exactly what happens depends on the values of `object` and `data`. The following possibilities are evaluated in the order listed:

object is a nauf.frame

All arguments besides `object` are ignored, and the information in `object` is used to create the model matrix.

data is a nauf.frame

All arguments besides `data` are ignored, and the information in `data` is used to create the model matrix.

object is a formula and data is a data.frame

`nauf_model.frame` is called with `formula = object` and `data = data`, passing along any additional arguments in `...` (including `ncs_scale`). Then the model matrix is created using the information in the resulting `nauf.frame`.

any other argument values

An error is returned.

Value

A fixed effects model matrix that implements `nauf_contrasts`. Unlike the default `model.matrix` method, the model matrix does not have a `contrasts` attribute, since multiple sets of contrasts may be required for some unordered factors.

`nauf_contrasts` for a description of the contrasts applied to unordered factors, `nauf_model.frame` for creating a model frame with `nauf` contrasts, and `nauf_glFormula` for obtaining both fixed effects and random effects model matrices.
 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```dat <- plosives dat\$spont[dat\$dialect == "Valladolid"] <- NA form <- intdiff ~ voicing * dialect * spont + (1 + voicing * spont | speaker) + (1 + dialect | item) sobj <- standardize(form, dat) mf <- nauf_model.frame(sobj\$formula, sobj\$data) ## the following all result in the same model matrix mm1 <- nauf_model.matrix(mf) mm2 <- nauf_model.matrix(form, mf) # 'form' ignored mm3 <- nauf_model.matrix(sobj\$formula, sobj\$data) ```