Datahat: Difference between revisions
imported>Scott |
imported>Jeremy No edit summary |
||
Line 7: | Line 7: | ||
:xhat = datahat(model); | :xhat = datahat(model); | ||
:[xhat,resids] = datahat(model,''data''); | :[xhat,resids] = datahat(model,''data''); | ||
:[xhat,resids] = datahat(loadings,''data''); | |||
===Description=== | ===Description=== | ||
Given a standard model structure (model), DATAHAT computes the model estimate of the data (xhat). For example, if (model) is a PCA model of a matrix '''X'''<sub>cal</sub> such that '''X'''<sub>cal</sub> = '''TP'''<sup>T</sup> + '''E''', then '''X'''<sub>hat</sub> = '''TP'''<sup>T</sup> | Given a standard model structure (model), DATAHAT computes the model estimate of the data (xhat). For example, if (model) is a PCA model of a matrix: | ||
: '''X'''<sub>cal</sub> such that '''X'''<sub>cal</sub> = '''TP'''<sup>T</sup> + '''E''', then '''X'''<sub>hat</sub> = '''TP'''<sup>T</sup> | |||
that is: | |||
:'''X'''<sub>cal</sub> = '''TP'''<sup>T</sup> + '''E''' = '''X'''<sub>hat</sub> + '''E'''. | |||
If optional input (''data'') is supplied then DATAHAT computes the model estimate of (''data'') | If optional input (''data'') is supplied then DATAHAT computes the model estimate of (''data'') which will be output in (xhat). For the PCA model of matrix '''X'''<sub>cal</sub>, and (''data'') is a data matrix '''X'''<sub>new</sub> then: | ||
:'''X'''<sub>hat</sub> = '''X'''<sub>new</sub>'''PP'''<sup>T</sup> = '''T'''<sub>new</sub>'''P'''<sup>T</sup> | |||
and the output (resids) is a matrix with the corresponding residuals: | |||
:'''E''' = '''X'''<sub>new</sub>-'''X'''<sub>new</sub>'''PP'''<sup>T</sup> = '''X'''<sub>new</sub>('''I'''-'''PP'''<sup>T</sup>) | |||
If (''data'') is '''X'''<sub>cal</sub> then: | |||
:'''X'''<sub>hat</sub> = '''TP'''<sup>T</sup> | |||
and resids is: | |||
:'''E''' = '''X'''<sub>cal</sub>('''I'''-'''PP'''<sup>T</sup>). | |||
Note that preprocessing in (model) will be performed before the residuals are calculated. If data is not provided, only (xhat) of the calibration data is available. | Note that preprocessing in (model) will be performed before the residuals are calculated. If data is not provided, only (xhat) of the calibration data is available. | ||
Note that DATAHAT works with almost all standard model structures. | Note that DATAHAT works with almost all standard model structures or a cell-array of loadings can be supplied in place of model (for use with multiway models only). | ||
===See Also=== | ===See Also=== | ||
[[analysis]], [[npls]], [[parafac]], [[parafac2]], [[qconcalc]], [[residuallimit]], [[tconcalc]], [[tsqmtx]], [[tsqqmtx]], [[tucker]], [[varcap]], [[varcapy]] | [[analysis]], [[npls]], [[parafac]], [[parafac2]], [[qconcalc]], [[residuallimit]], [[tconcalc]], [[tsqmtx]], [[tsqqmtx]], [[tucker]], [[varcap]], [[varcapy]] |
Latest revision as of 12:05, 22 February 2013
Purpose
Calculates the model estimate and residuals of the data.
Synopsis
- xhat = datahat(model);
- [xhat,resids] = datahat(model,data);
- [xhat,resids] = datahat(loadings,data);
Description
Given a standard model structure (model), DATAHAT computes the model estimate of the data (xhat). For example, if (model) is a PCA model of a matrix:
- Xcal such that Xcal = TPT + E, then Xhat = TPT
that is:
- Xcal = TPT + E = Xhat + E.
If optional input (data) is supplied then DATAHAT computes the model estimate of (data) which will be output in (xhat). For the PCA model of matrix Xcal, and (data) is a data matrix Xnew then:
- Xhat = XnewPPT = TnewPT
and the output (resids) is a matrix with the corresponding residuals:
- E = Xnew-XnewPPT = Xnew(I-PPT)
If (data) is Xcal then:
- Xhat = TPT
and resids is:
- E = Xcal(I-PPT).
Note that preprocessing in (model) will be performed before the residuals are calculated. If data is not provided, only (xhat) of the calibration data is available.
Note that DATAHAT works with almost all standard model structures or a cell-array of loadings can be supplied in place of model (for use with multiway models only).
See Also
analysis, npls, parafac, parafac2, qconcalc, residuallimit, tconcalc, tsqmtx, tsqqmtx, tucker, varcap, varcapy