lmwModelMatrix: Creates the model matrix

View source: R/lmwModelMatrix.R

lmwModelMatrixR Documentation

Creates the model matrix

Description

Creates the model matrix X from the design matrix and the formula of the model.

Usage

lmwModelMatrix(lmwDataList)

Arguments

lmwDataList

A list containing the outcomes, the experimental design and the formula.

Details

In typical ASCA-GLM analysis, the GLM model needs the design to be re-encoded with the commonly used in industrial experimental design sum coding. The result is the model matrix. Suppose the design matrix is nxk with n observations and k factors. After the transformation, the model matrix will be nxK. For a parameter with a levels, the re-encoding is a-1 columns with 0 and 1 for the a-1 first levels and -1 for the last one. K is the sum of all the columns for every parameters.

Value

A list with the 5 following named elements :

lmwDataList

The initial object: a list with outcomes, design and formula.

modelMatrix

A nxK model matrix specifically encoded for the ASCA-GLM method.

modelMatrixByEffect

A list of p model matrices for each model effect.

effectsNamesUnique

A character vector with the p names of the model effects, each repeated once.

effectsNamesAll

A character vector with the K names of the model effects ordered and repeated as the column names of the model matrix.

References

Thiel M.,Feraud B. and Govaerts B. (2017) ASCA+ and APCA+: Extensions of ASCA and APCA in the analysis of unbalanced multifactorial designs, Journal of Chemometrics

See Also

model.matrix

More information about the specific encoding is available in the article from (Thiel et al, 2017)

Examples


data('UCH')
resLmwModelMatrix <- lmwModelMatrix(UCH)

head(resLmwModelMatrix$modelMatrix)


bgovaerts/LMWiRe documentation built on Sept. 17, 2022, 12:32 a.m.