Modelstruct: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Jeremy
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===Purpose===
===Purpose===


Line 10: Line 9:
===Description===
===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).
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.  


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:
For information on the contents of a model structure, see the advanced topics page [[Standard_Model_Structure]].


:opts.plots = 'none';      % turn off plots for PCA (see PCA)
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 the supported model types.


:modl = pca(x, 3, opts);  % create a PCA model from data X
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:
 
:modlrder(modl);          % display relevent model information


:plotscores(modl);        % plot scores from model
<pre>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</pre>


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:
Line 46: Line 46:
* '''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 <tt>[modes, blocks]</tt> 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 <tt>modl.loads{1,1}</tt> and traditional "loadings" in <tt>modl.loads{2,1}</tt>.


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:


:>> modl.modeltype
<pre>>> modl.modeltype
ans =
PCA
>> modl.loads
ans =
    [30x4 double]
    [10x4 double]</pre>


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


:PCA
Read more about model structures here: [[Standard_Model_Structure]]
 
:>> 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===
===See Also===


[[analysis]], [[explode]], [[parafac]], [[pca]], [[pcr]], [[pls]]
[[analysis]], [[explode]], [[parafac]], [[pca]], [[pcr]], [[pls]]

Latest revision as of 12:06, 19 February 2010

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.

For information on the contents of a model structure, see the advanced topics page Standard_Model_Structure.

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 the supported model types.

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.

Read more about model structures here: Standard_Model_Structure

See Also

analysis, explode, parafac, pca, pcr, pls