# Mlsca

## Contents

### Purpose

Multi-level simultaneous component analysis (MLSCA) is a method which analyzes the variability in datasets from designed experiments with nested factors. It separates variability into that associated with each factor and the residuals, estimating the contribution of each factor to total sum of squares. A PCA model is built for each factor showing the scores and loadings for these effects. MLSCA also builds a PCA model on the residuals, or “within” variability. The “Within” variability is often the focus of the analysis.

MLSCA is a special case of ASCA. However, as implemented, ASCA is intended for crossed experimental designs while MLSCA is for nested experimental designs.

MLSCA is implemented following de Noord and Theobald, Multilevel component analysis and multilevel PLS of chemical process data", J. Chemometrics 2005. See also Timmerman, "Multilevel Component Analysis", Brit. J. Mathemat. Statist. Psychol. 2006.

### Synopsis

- [model] = mlsca(X, F);
- [model] = mlsca(X, F, ncomp);
- [model] = mlsca(X, F, ncomp, options);

### Description

Build an MLSCA model by applying MLSCA to X-block data, X, measured according to an experimental design, F. An MLSCA model is intended to show which factors are significant in explaining the experimental data, and showing the inherent variability once the confounding effects of the higher-level groupings are removed.

The helper function "plotscores_mlsca" is useful for viewing the results of MLSCA. An example of its use is seen in the MLSCA demo ("mlscademo" function).

#### Inputs

**X**= the experimental value determined for each experiment/row of F.**F**= array or dataset experiment design matrix describing the settings of each X variable (cols) for each sample (row).

#### Optional Inputs

**ncomp**= a cell array of integer values indicating the number of Principal Components to use in each sub-model, or a single integer value which will be used as the number of Principal Components for each sub-model. If omitted, the maximum number of components for each submodel will be calculated.

#### Outputs

**model**= an MLSCA standard model structure containing fields (when input matrix X has size mxn):

- submodel: {1xnsub cell} of evrimodels. nsub is the number of PCA sub-models used (nsub = sum of nested factors +1).
- combinedscores: [mxp dataset], combination of sub-model scores. p is the cumulative number of PCs used over all PCA sub-models. Column class sets identify which sub-model and PC number each column is associated with.
- combinedqs: [mxnsub dataset] combination of Qs for each PCA sub-model.
- combinedloads: [nxp dataset], combination of sub-model loads. p is the total number of PCs used over all PCA submodels. Column class sets identify which sub-model and PC number each column is associated with.
- detail, structure which contains field:
- effects: The percentage each effect (overall mean, factors, interactions and residuals) contributes to the sum of squares of the data matrix X.
- data: cell array containing input X and F.

### Options

options = a structure array with the following fields:

**display**: [{'off'}| 'on' ] governs output to the command window.**blockdetails**: [ {'standard'} | 'all' ] Extent of detail included in model. 'standard' keeps only y-block, 'all' keeps both x- and y- blocks**preprocessing**: {[]} preprocessing structure for x block (see PREPROCESS).

### Example

>>mlscademo