Learn R Programming

HDANOVA (version 0.8.3)

pcanova: Principal Components Analysis of Variance Simultaneous Component Analysis - PC-ANOVA

Description

This is a quite general and flexible implementation of PC-ANOVA.

Usage

pcanova(formula, data, ncomp = 0.9, contrasts = "contr.sum", ...)

Value

A pcanova object containing loadings, scores, explained variances, etc. The object has associated plotting (pcanova_plots) and result (pcanova_results) functions.

Arguments

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 hdanova function.

Details

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.

References

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.

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

Run this code
# 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)

Run the code above in your browser using DataLab