Skip to contents

Estimates the model by OLS based on the outcomes and model matrices provided in the outputs of lmpModelMatrix function and calculates the estimated effect matrices \(\hat{\mathbf{M}}_0, \hat{\mathbf{M}}_1, ...\hat{\mathbf{M}}_F\), ... and residual matrix \(\hat{\mathbf{E}}\). It calculates also the type III percentage of variance explained by each effect.

Usage

lmpEffectMatrices(resLmpModelMatrix, SS = TRUE, contrastList = NA)

Arguments

resLmpModelMatrix

A list of 5 elements from lmpModelMatrix.

SS

Logical. If FALSE, won't compute the percentage of variance for each effect.

contrastList

A list of contrasts for each parameter. If NA, the function creates automatically the list by default.

Value

A list with the following elements:

lmpDataList

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

modelMatrix

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

modelMatrixByEffect

A list of F+1 model matrices for each effect.

effectsNamesUnique

A character vector with the F+1 names of the model effects, each repeated once.

effectsNamesAll

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

effectMatrices

A list of F+1 effect matrices for each model effect.

predictedvalues

The nxm matrix of predicted outcome values.

residuals

The nxm matrix of model residuals.

parameters

The pxm matrix of the estimated parameters.

type3SS

A vector with the type III sum of squares for each model effect (If SS = TRUE).

variationPercentages

A vector with the percentage of variance for each model effect (If SS = TRUE).

varPercentagesPlot

A ggplot bar plot of the contributions of each model effect to the total variance (If SS = TRUE).

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

Examples

data("UCH")
resLmpModelMatrix <- lmpModelMatrix(UCH)
reslmpEffectMatrices <- lmpEffectMatrices(resLmpModelMatrix)
reslmpEffectMatrices$varPercentagesPlot