FAQ  Frequently Asked Questions
Issue:

How are Tcontributions calculated?
Possible Solutions:

In PCA, Tcontributions represent how the original variables contribute to give each sample its T^{2} value in a given model. They are calculated as if you are reconstructing the data (relative to the mean of the calibration data) except that each factor is first normalized by the variance it captured in the original data. This gives the reconstruction of the data as if all principal components captured equal amounts of variance in the original data. In other words: this is how the original variables project into the normalized multivariate space of the model.
To calculate the Tcontributions for a given sample in a PLS_Toolbox PCA model, use the
tconcalc
function. Given the sample's data in variable data
and the model in variable model
, the following will calculate Tcontributions.
T_con = tconcalc(data,model);Note that if data is a matrix of all your data and you want only a single sample's T contributions, pass only that sample's row:
data(row_number,:)
.
Numerical Calculation Details
To calculate the Tcontributions for the "i"th sample (
T_con_i
) in Matlab notation:
T_con_i = t_i*L*U
where
t_i
is a row vector of the scores (size: 1 x k) for a given sample, U
is the transposed matrix of loadings (size: n x k), and L
is a diagonal matrix containing the inverse of the square root of the eigenvalues for the k components. For example, with a three PC model, L
would be: 1/λ_{1}^{1/2} 0 0
0 1/λ_{2}^{1/2} 0
0 0 1/λ_{3}^{1/2}
Where λ_{j}
is the eigenvalue for component j
. Note the similarity of the Tcontributions equation to data reconstruction:
T_con_i = t_i*L*U %calculate Tcontributions
x_hat_i = t_i* U %calculate data approx.
x_hat_i
is data approximation for sample i (relative to the mean of the calibration data).
Putting all this together, you can calculate
T_con_i
by hand for a given sample in the calibration data used for a PLS_Toolbox PCA model using:
T = model.loads{1}; %Grab scores (note: for all samples!)
t_i = T(i,:); %grab scores for one sample
U = model.loads{2}'; %Grab loadings
ncomp = size(U,1);
L = diag(1./sqrt(model.detail.ssq(1:ncomp,2)));
T_con_i = t_i*L*U; %calculate Tcontributions
Still having problems? Check our documentation Wiki or try writing our helpdesk at helpdesk@eigenvector.com