Mpca: Difference between revisions
imported>Donal |
imported>Donal |
||
Line 15: | Line 15: | ||
Inputs to MPCA are the multi-way array mwa (class "double" or "dataset") and the number of components to use in the model nocomp. To make predictions with new data the inputs are the multi-way array mwa and the MPCA model model. Optional input ''options'' is discussed below. | Inputs to MPCA are the multi-way array mwa (class "double" or "dataset") and the number of components to use in the model nocomp. To make predictions with new data the inputs are the multi-way array mwa and the MPCA model model. Optional input ''options'' is discussed below. | ||
For assistance in preparing batch data for use in MPCA please see [[bspcgui]]. | |||
The output model is a structure array with the following fields: | The output model is a structure array with the following fields: |
Revision as of 11:42, 25 October 2012
Purpose
Multi-way (unfold) principal components analysis.
Synopsis
- model = mpca(mwa,ncomp,options)
- model = mpca(mwa,ncomp,preprostring)
- pred = mpca(mwa,model,options)
Description
Principal Components Analysis of multi-way data using unfolding to a 2-way matrix followed by conventional PCA.
Inputs to MPCA are the multi-way array mwa (class "double" or "dataset") and the number of components to use in the model nocomp. To make predictions with new data the inputs are the multi-way array mwa and the MPCA model model. Optional input options is discussed below.
For assistance in preparing batch data for use in MPCA please see bspcgui.
The output model is a structure array with the following fields:
- modeltype: 'MPCA',
- datasource: structure array with information about the x-block,
- date: date of creation,
- time: time of creation,
- info: additional model information,
- loads: 1 by 2 cell array with model loadings for each mode/dimension,
- pred: cell array with model predictions for each input data block (this is empty if options.blockdetail = 'normal'),
- tsqs: cell array with T2 values for each mode,
- ssqresiduals: cell array with sum of squares residuals for each mode,
- description: cell array with text description of model, and
- detail: sub-structure with additional model details and results.
Options
- options = a structure array with the following fields.
- display: [ 'off' | {'on'} ] governs level of display to command window,
- plots: [ 'none' | {'final'} ] governs level of plotting,
- outputversion: [ 2 | {3} ] governs output format,
- preprocessing: { [] } preprocessing structure, {default is mean centering i.e. options.preprocessing = preprocess('default', 'mean center')} (see PREPROCESS),
- blockdetails: [ 'compact' | {'standard'} | 'all' ] extent of detail in predictions and residuals included in model structure ('standard' results in sum of squared residuals, and 'all' gives all x-block residuals), and
- samplemode: [ {3} ] mode (dimension) to use as the sample mode e.g. if it is 3 then it is assumed that mode 3 is the sample/object dimension i.e. if mwa is 7x9x10 then the scores model.loads{1} will have 10 rows (it will be 10xncomp).
The default options can be retreived using: options = mpca('options');.
It is also possible to input just the preprocessing option as an ordinary string in place of options and have the remainder of options filled in with the defaults from above. The following strings are valid:
- 'none': no scaling,
- 'auto': unfolds array then applies autoscaling,
- 'mncn': unfolds array then applies mean centering, or
- 'grps': {default} unfolds array then group/block scales each variable, i.e. the same variance scaling is used for each variable along its time trajectory (see GSCALE).
MPCA will work with arrays of order 3 and higher. For higher order arrays, the last order is assumed to be the sample order, i.e. for an array of order n with the dimension of order n being m, the unfolded matrix will have m samples. For arrays of higher order the group scaling option will group together all data with the same order 2 index, for multiway array mwa, each mwa(:,j,:, ... ,:) will be scaled as a group.