Tsqmtx: 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 1: Line 1:
===Purpose===
===Purpose===
Calculates the Hotelling's T<sup>2</sup> contributions for PCA.
Calculates the Hotelling's T<sup>2</sup> contributions for PCA.
===Synopsis===
===Synopsis===
:[tsqmat,tsqs] = tsqmtx(x,model)
:[tsqmat,tsqs] = tsqmtx(x,model)
:[tsqmat,tsqs] = tsqmtx(x,p,ssq)
:[tsqmat,tsqs] = tsqmtx(x,p,ssq)
===Description===
===Description===
TSQMTX calculates the Hotelling's T<sup>2</sup> contributions for PCA.
TSQMTX calculates the Hotelling's T<sup>2</sup> contributions for PCA.
====INPUTS====
====INPUTS====
* '''x''' = data matrix (class "double" or "dataset), and
* '''x''' = data matrix (class "double" or "dataset), and
* '''model''' =  model structure returned from ANALYSIS or PCA, or
* '''model''' =  model structure returned from ANALYSIS or PCA, or
* '''p''' = PCA loadings, and
* '''p''' = PCA loadings, and
* '''ssq''' =  variance captured table.
* '''ssq''' =  variance captured table.
If a PCA model structure model is input, the loadings and variance captured table are extracted from the model. Additionally, the preprocessing from the model is applied to the data prior to estimating the scores. However, if the loadings p and variance captured table ssq are passed as inputs then the data must be preprocessed in a manner similar to the data used to calibrate the PCA model.
If a PCA model structure model is input, the loadings and variance captured table are extracted from the model. Additionally, the preprocessing from the model is applied to the data prior to estimating the scores. However, if the loadings p and variance captured table ssq are passed as inputs then the data must be preprocessed in a manner similar to the data used to calibrate the PCA model.
====OUTPUTS====
====OUTPUTS====
* '''tsqmat''' = indivual variable contributions to Hotelling's T<sup>2</sup>, and
* '''tsqmat''' = indivual variable contributions to Hotelling's T<sup>2</sup>, and
* '''tsqs''' = Hotelling's T<sup>2</sup> for each sample.
* '''tsqs''' = Hotelling's T<sup>2</sup> for each sample.
===ALGORITHM===
===ALGORITHM===
If '''P''' is the loadings matrix and '''T''' is the scores matrix from the calibration data that had ''M'' samples, then '''S''' is a diagonal matrix defined as '''S''' = '''T'''<sup>T</sup>'''T'''/(''M''-1). For a new sample '''x'''<sub>new</sub> (row vector that has been appropriately scaled) the T<sup>2</sup> contribution '''t'''<sub>con</sub> is calculated as '''t'''<sub>con</sub> = '''x'''<sub>new</sub>'''PS'''<sup>-1/2</sup>'''P'''<sup>T</sup>.
If '''P''' is the loadings matrix and '''T''' is the scores matrix from the calibration data that had ''M'' samples, then '''S''' is a diagonal matrix defined as '''S''' = '''T'''<sup>T</sup>'''T'''/(''M''-1). For a new sample '''x'''<sub>new</sub> (row vector that has been appropriately scaled) the T<sup>2</sup> contribution '''t'''<sub>con</sub> is calculated as '''t'''<sub>con</sub> = '''x'''<sub>new</sub>'''PS'''<sup>-1/2</sup>'''P'''<sup>T</sup>.
===See Also===
===See Also===
[[datahat]], [[pca]], [[pcr]], [[pls]]
[[datahat]], [[pca]], [[pcr]], [[pls]]

Revision as of 15:27, 3 September 2008

Purpose

Calculates the Hotelling's T2 contributions for PCA.

Synopsis

[tsqmat,tsqs] = tsqmtx(x,model)
[tsqmat,tsqs] = tsqmtx(x,p,ssq)

Description

TSQMTX calculates the Hotelling's T2 contributions for PCA.

INPUTS

  • x = data matrix (class "double" or "dataset), and
  • model = model structure returned from ANALYSIS or PCA, or
  • p = PCA loadings, and
  • ssq = variance captured table.

If a PCA model structure model is input, the loadings and variance captured table are extracted from the model. Additionally, the preprocessing from the model is applied to the data prior to estimating the scores. However, if the loadings p and variance captured table ssq are passed as inputs then the data must be preprocessed in a manner similar to the data used to calibrate the PCA model.

OUTPUTS

  • tsqmat = indivual variable contributions to Hotelling's T2, and
  • tsqs = Hotelling's T2 for each sample.

ALGORITHM

If P is the loadings matrix and T is the scores matrix from the calibration data that had M samples, then S is a diagonal matrix defined as S = TTT/(M-1). For a new sample xnew (row vector that has been appropriately scaled) the T2 contribution tcon is calculated as tcon = xnewPS-1/2PT.

See Also

datahat, pca, pcr, pls