Modelstruct: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Jeremy
(Importing text file)
Line 11: Line 11:
:plotscores(modl);        % plot scores from model
:plotscores(modl);        % plot scores from model
Although the individual fields (contents) of each model vary between modeltypes, most contain at least these fields:
Although the individual fields (contents) of each model vary between modeltypes, most contain at least these fields:
* modeltype: name of model,
* '''modeltype''': name of model,
* datasource: structure array with information about input data,
* '''datasource''': structure array with information about input data,
* date: date of creation,
* '''date''': date of creation,
* time: time of creation,
* '''time''': time of creation,
* info: additional model information,
* '''info''': additional model information,
* loads: cell array with model loadings for each mode/dimension,
* '''loads''': cell array with model loadings for each mode/dimension,
* pred: cell array with model predictions for input data block (the first cell is empty if options.blockdetail = 'normal'),
* '''pred''': cell array with model predictions for input data block (the first cell is empty if options.blockdetail = 'normal'),
* tsqs: cell array with T<sup>2</sup> values for each mode,
* '''tsqs''': cell array with T<sup>2</sup> values for each mode,
* ssqresiduals: cell array with sum of squares residuals for each mode,
* '''ssqresiduals''': cell array with sum of squares residuals for each mode,
* description: cell array with text description of model, and
* '''description''': cell array with text description of model, and
* detail: sub-structure with additional model details and results.
* '''detail''': sub-structure with additional model details and results.
Note that fields such as loads, tsqs and ssqresiduals are cell arrays of size [modes, blocks] where modes is the dimensionality of the data (e.g. for an array, modes = 2) and blocks is the number of blocks used by the analysis method (e.g. for PCA, blocks = 1, for PLS, blocks = 2). Thus, for a standard PCA model, loads will be a 2x1 cell containing "scores" in modl.loads{1,1} and traditional "loadings" in modl.loads{2,1}.
Note that fields such as loads, tsqs and ssqresiduals are cell arrays of size [modes, blocks] where modes is the dimensionality of the data (e.g. for an array, modes = 2) and blocks is the number of blocks used by the analysis method (e.g. for PCA, blocks = 1, for PLS, blocks = 2). Thus, for a standard PCA model, loads will be a 2x1 cell containing "scores" in modl.loads{1,1} and traditional "loadings" in modl.loads{2,1}.
Because the models are standard MATLAB structures, they can be examined using standard structure notation:
Because the models are standard MATLAB structures, they can be examined using standard structure notation:

Revision as of 20:56, 2 September 2008

Purpose

Constructs an empty model structure.

Synopsis

model = modelstruct(modeltype,pred)

Description

The output of many of the PLS_Toolbox functions is a single model structure in which the results of the analysis are contained. A structure is an organized group of variables all stored as "fields" of a single containing variable. The purpose of MODELSTRUCT is to create the empty model structures used by the various modeling routines. The type of structure requested is passed as the single string input modeltype and should be one of: 'pca', 'pcr', (for PCA or PCR models) 'nip', 'sim' (PLS models), or 'parafac' (PARAFAC model). Once the structures created by MODELSTRUCT are filled-in by the appropriate function (e.g. PLS, PCR, PCA), they contain all the results of the analysis and can be used as a single object for making further predictions or plots from the modeling results. In many cases, these models can be passed whole to another function. For example:

opts.plots = 'none';  % turn off plots for PCA (see PCA)
modl = pca(x, 3, opts);  % create a PCA model from data X
modlrder(modl);  % display relevent model information
plotscores(modl);  % plot scores from model

Although the individual fields (contents) of each model vary between modeltypes, most contain at least these fields:

  • modeltype: name of model,
  • datasource: structure array with information about input data,
  • date: date of creation,
  • time: time of creation,
  • info: additional model information,
  • loads: cell array with model loadings for each mode/dimension,
  • pred: cell array with model predictions for input data block (the first cell 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.

Note that fields such as loads, tsqs and ssqresiduals are cell arrays of size [modes, blocks] where modes is the dimensionality of the data (e.g. for an array, modes = 2) and blocks is the number of blocks used by the analysis method (e.g. for PCA, blocks = 1, for PLS, blocks = 2). Thus, for a standard PCA model, loads will be a 2x1 cell containing "scores" in modl.loads{1,1} and traditional "loadings" in modl.loads{2,1}. Because the models are standard MATLAB structures, they can be examined using standard structure notation:

>> modl.modeltype
ans =
PCA
>> modl.loads
ans =
[30x4 double]
[10x4 double]

Additionally, the individual components of a model can be "exploded" into individual variables using the EXPLODE function.

See Also

analysis, explode, parafac, pca, pcr, pls