Learn R Programming

mixOmics (version 5.0-4)

withinVariation: Within matrix decomposition for repeated measurements (cross-over design)

Description

This function is called by the multilevel function for cross-over design data, but can be called independently for other types of analyses (e.g. PCA multilevel).

Usage

withinVariation(X, design)

Arguments

X
numeric matrix of predictors. NAs are allowed.
design
a numeric matrix or data frame. The first column indicates the repeated measures on each individual, i.e. the individuals ID. If method = 'splsda', the 2nd and 3rd columns are factors. If method = 'spls' then you can choose

Value

  • withinVariation simply returns the $Xw$ within matrix, which can be input in the other multivariate approaches already implemented in mixOmics (i.e. spls or splsda, see multilevel, but also pca or ipca).

encoding

latin1

Details

withinVariation function decomposes the Within variation in the $X$ data set. The resulting $Xw$ matrix is then input in the multilevel function.

One or two-factor analyses are available.

References

On multilevel analysis:

Liquet, B., Le Cao, K.-A., Hocini, H. and Thiebaut, R. (2012) A novel approach for biomarker selection and the integration of repeated measures experiments from two platforms. BMC Bioinformatics 13:325.

Westerhuis, J. A., van Velzen, E. J., Hoefsloot, H. C., and Smilde, A. K. (2010). Multivariate paired data analysis: multilevel PLSDA versus OPLSDA. Metabolomics, 6(1), 119-128.

See Also

multilevel, spls, splsda, plotIndiv, plotVar, plot3dIndiv, plot3dVar, cim, network.

Examples

Run this code
## Example: one-factor analysis matrix decomposition
#--------------------------------------------------------------
data(vac18)
X <- vac18$genes
# in design we only need to mention the repeated measurements to split the one level variation
design <- data.frame(sample = vac18$sample)

Xw <- withinVariation(X = X, design = design)
# multilevel PCA
res.pca.1level <- pca(Xw, ncomp = 3)

# compare a normal PCA with a multilevel PCA for repeated measurements.
# note: PCA makes the assumptions that all samples are independent, 
# so this analysis is flawed and you should use a multilevel PCA instead
res.pca <- pca(X, ncomp = 3)

# set up colors for plotIndiv
col.stim <- c("darkblue", "purple", "green4","red3")
col.stim <- col.stim[as.numeric(vac18$stimulation)]

# plotIndiv comparing both PCA and PCA multilevel
plotIndiv(res.pca, ind.names = vac18$stimulation, col = col.stim)
title(main = 'PCA ')
plotIndiv(res.pca.1level, ind.names = vac18$stimulation, col = col.stim)
title(main = 'PCA multilevel')

Run the code above in your browser using DataLab