pcanova | R Documentation |
This is a quite general and flexible implementation of PC-ANOVA.
pcanova(formula, data, ncomp = 0.9, contrasts = "contr.sum", ...)
formula |
Model formula accepting a single response (block) and predictor names separated by + signs. |
data |
The data set to analyse. |
ncomp |
The number of components to retain, proportion of variation or default = minimum cross-validation error. |
contrasts |
Effect coding: "sum" (default = sum-coding), "weighted", "reference", "treatment". |
... |
Additional parameters for the |
PC-ANOVA works in the opposite order of ASCA. First the response matrix is decomposed using ANOVA. Then the components are analysed using ANOVA with respect to a design or grouping in the data. The latter can be ordinary fixed effects modelling or mixed models.
A pcanova
object containing loadings, scores, explained variances, etc. The object has
associated plotting (pcanova_plots
) and result (pcanova_results
) functions.
Luciano G, Næs T. Interpreting sensory data by combining principal component analysis and analysis of variance. Food Qual Prefer. 2009;20(3):167-175.
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
# Load candies data
data(candies)
# Basic PC-ANOVA model with two factors, cross-validated opt. of #components
mod <- pcanova(assessment ~ candy + assessor, data = candies)
print(mod)
# PC-ANOVA model with interaction, minimum 90% explained variance
mod <- pcanova(assessment ~ candy * assessor, data = candies, ncomp = 0.9)
print(mod)
summary(mod)
# Tukey group letters for 'candy' per component
lapply(mod$models, function(x)
mixlm::cld(mixlm::simple.glht(x,
effect = "candy")))
# Result plotting
loadingplot(mod, scatter=TRUE, labels="names")
scoreplot(mod)
# Mixed Model PC-ANOVA, random assessor
mod.mix <- pcanova(assessment ~ candy + r(assessor), data=candies, ncomp = 0.9)
scoreplot(mod.mix)
# Fixed effects
summary(mod.mix)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.