Varcap: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
No edit summary
imported>Scott
No edit summary
 
Line 1: Line 1:
===Purpose===
===Purpose===


Variance captured for each variable in PCA model.
Variance captured for each variable in any 2-way factor-based model.


===Synopsis===
===Synopsis===


:vc = varcap(x,loads,''scl,plots'')
:vc = varcap(X,T,P,scl,plots);
:vc = varcap(X,model,scl,plots);


===Description===
===Description===
Calculates percent variance captured in a model for each variable and number of components. Inputs are the properly scaled data (x) [MxN], and the associated scores (T) and loading matrices (P). Valid models include: PCA, PCR, PLS, CLS, LWR For non-orthogonal models, varcap splits variation into unique variance for each component and one common part.


VARCAP calculates and displays the percent variance captured for each variable and number of principal components in a PCA model.
Optional inputs are (scl) [1xN] which specifies the x-axis for plotting, and (plots) which suppresses plotting when set to 0.


Inputs are the properly scaled ''M'' by ''N'' data <tt>x</tt> (''i.e.'' scaled using the same scaling used when creating the PCA model) with associated ''N'' by ''K'' loadings matrix <tt>loads</tt>.
SPECIAL NOTES:
* Scores (T) can be omitted if and only if the loadings are ortho-normal (such as those from a PCA or PCR model) in which case, it will be assumed that scores can be calculated from:
: T = XP
: If this is not valid for the given loadings, the variance captured will be incorrect.


Optional input ''<tt>scl</tt>'' (1 by ''N'') specifies the x-axis for plotting. Optional input ''<tt>plots</tt>'' suppresses plotting when set to 0 {default = 1}.
* If a model is passed in place of T, the scores, loadings, and scale will be extracted from the model. Howver, a user-defined scale and the plots flag can be input along with the model.


The output is a ''K'' by ''N'' matrix of variance captured <tt>vc</tt> for each variable and each number of PCs considered (<tt>vc</tt> is size: [number of PCs by number of variables]). A stacked bar chart of <tt>vc</tt> is also plotted (See optional input ''<tt>plots</tt>'').
====Outputs====
The output is a matrix of % variance captured (vc) [K+2xN] for each variable on each component. Row one up to the number of components shows the UNIQUE variance of components (variance in common has been removed). Row component+1, shows the common variation. The last row is the total variation.


===See Also===
===See Also===


[[analysis]], [[pca]]
[[analysis]], [[pca]]

Latest revision as of 11:25, 14 March 2012

Purpose

Variance captured for each variable in any 2-way factor-based model.

Synopsis

vc = varcap(X,T,P,scl,plots);
vc = varcap(X,model,scl,plots);

Description

Calculates percent variance captured in a model for each variable and number of components. Inputs are the properly scaled data (x) [MxN], and the associated scores (T) and loading matrices (P). Valid models include: PCA, PCR, PLS, CLS, LWR For non-orthogonal models, varcap splits variation into unique variance for each component and one common part.

Optional inputs are (scl) [1xN] which specifies the x-axis for plotting, and (plots) which suppresses plotting when set to 0.

SPECIAL NOTES:

  • Scores (T) can be omitted if and only if the loadings are ortho-normal (such as those from a PCA or PCR model) in which case, it will be assumed that scores can be calculated from:
T = XP
If this is not valid for the given loadings, the variance captured will be incorrect.
  • If a model is passed in place of T, the scores, loadings, and scale will be extracted from the model. Howver, a user-defined scale and the plots flag can be input along with the model.

Outputs

The output is a matrix of % variance captured (vc) [K+2xN] for each variable on each component. Row one up to the number of components shows the UNIQUE variance of components (variance in common has been removed). Row component+1, shows the common variation. The last row is the total variation.

See Also

analysis, pca