# Tconcalc

Jump to navigation
Jump to search

### Purpose

Calculate Hotelling's T^{2} contributions for predictions on orthogonal models.
If the input (model) is a PCA model structure then p = model.loads{2} and the output contributions (tcon) and T^{2} (tsqs) are calculated for a row vector x [e.g., a row of input (newx)] as

tcon = x*p*sqrt(inv(s))*p'; tsqs = tcon*tcon';

### Synopsis

- [tcon,tsqs] = tconcalc(newx,model)
- [tcon,tsqs] = tconcalc(pred,model)
- [tcon,tsqs] = tconcalc(model)
- [tcon,tsqs] = tconcalc(newx,p,ssq)

### Description

Inputs are the new data `newx` and the 2-way PCA or regression model for which T^{2} contributions should be calculated `model`. Alternatively, the prediction structure `pred` calculated with new data can be used in place of the new data itself or both can be omitted (passing `model` only) to get T^{2} contributions for the calibration data.

#### Inputs

**newx**= new X-block class "double" or "dataset"**model**= 2-way PCA or regression model for which T2 contributions are to be calculated.**pred**= prediction structure calculated for the new data.**p**= PCA loadings**ssq**= variance table (ssq). See PCA for more information. Note: For this I/O the data matrix (newx) must be scaled in a similar manner to the data used to determine the loadings (p).

#### Outputs

**tcon**= T^2 contributions.**tsqs**= Hotelling's T^2.