limmpca: Linear Mixed Model PCA

View source: R/limmpca.R

limmpcaR Documentation

Linear Mixed Model PCA

Description

This function mimics parts of the LiMM-PCA framework, combining ASCA+ and linear mixed models to analyse high-dimensional designed data. The default is to use REML estimation and scaling of the backprojected errors. See examples for alternatives.

Usage

limmpca(
  formula,
  data,
  pca.in = 5,
  aug_error = 0.05,
  use_ED = FALSE,
  REML = TRUE,
  contrasts = "contr.sum",
  permute = FALSE,
  perm.type = c("approximate", "exact"),
  SStype = "III",
  ...
)

Arguments

formula

Model formula accepting a single response (block) and predictors. See Details for more information.

data

The data set to analyse.

pca.in

Compress response before ASCA (number of components), default = 5.

aug_error

Error term of model ("denominator", "residual", numeric alpha-value). The latter implies the first with a scaling factor.

use_ED

Use Effective Dimensions instead of degrees of freedom when scaling.

REML

Use restricted maximum likelihood estimation. Alternatives: TRUE (default), FALSE (ML), NULL (least squares).

contrasts

Effect coding: "sum" (default = sum-coding), "weighted", "reference", "treatment".

permute

Number of permutations to perform (default = 1000).

perm.type

Type of permutation to perform, either "approximate" or "exact" (default = "approximate").

SStype

Type of sum-of-squares: "I" = sequential, "II" = last term, obeying marginality, "III" (default) = last term, not obeying marginality.

...

Additional arguments to hdanova.

Details

The Sum of Squares for the model is dependent on the SStype of the model. For SStype = "I" and SStype = "II" the SSQ is based on LLR (possibly inflating large contributions), while it is directly estimated from the model for SStype = "III". SStype = "III" is the default for LiMM-PCA and should be combined with sum coding. Sum of Squares for the random effects are based on the variance components.

Value

An object of class limmpca, inheriting from the general asca class.

References

  • Martin, M. and Govaerts, B. (2020). LiMM-PCA: Combining ASCA+ and linear mixed models to analyse high-dimensional designed data. Journal of Chemometrics, 34(6), e3232.

See Also

Main methods: asca, apca, limmpca, msca, pcanova, prc and permanova. Workhorse function underpinning most methods: hdanova. Extraction of results and plotting: asca_results, asca_plots, pcanova_results and pcanova_plots

Examples

# Load candies data
data(candies)

# Default LiMM-PCA model with two factors and interaction, 5 PCA components
mod <- limmpca(assessment ~ candy*r(assessor), data=candies)
summary(mod)
scoreplot(mod, factor = "candy")

# LiMM-PCA with least squares estimation and 8 PCA components
modLS <- limmpca(assessment ~ candy*r(assessor), data=candies, REML=NULL, pca.in=8)
summary(modLS)
scoreplot(modLS, factor = "candy")

# Load Caldana data
data(caldana)

# Combining effects in LiMM-PCA (assuming light is a random factor)
mod.comb <- limmpca(compounds ~ time + comb(r(light) + r(time:light)), data=caldana, pca.in=8)
summary(mod.comb)

HDANOVA documentation built on Aug. 31, 2025, 1:07 a.m.