Discussion:
PCA Q statistic (SPE) Hotelling T2
(too old to reply)
alkan alkaya
2009-11-19 15:30:31 UTC
Permalink
Raw Message
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
Peter Perkins
2009-11-22 15:49:59 UTC
Permalink
Raw Message
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
alkan alkaya
2009-11-23 15:30:20 UTC
Permalink
Raw Message
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Thank you peter perkins,

I could see the T2 plot by using PRINCOMP function but I couldn't plot the Q statistic. I have 1024*4 matrix 4= variables,1024= samples. When I use PCARES function I have RESIDUAL=R with same dimension (1024*4). for Q statistic as I know Q=R'*R after this calculation Q matrix occurs with 4*4 dimension but I think It should be 1*1024 dimension in order to plot Q test like T2 testing. I think I miss something. Thanks for your help.
Peter Perkins
2009-11-23 21:02:09 UTC
Permalink
Raw Message
Post by alkan alkaya
I could see the T2 plot by using PRINCOMP function but I couldn't plot the Q statistic. I have 1024*4 matrix 4= variables,1024= samples. When I use PCARES function I have RESIDUAL=R with same dimension (1024*4). for Q statistic as I know Q=R'*R after this calculation Q matrix occurs with 4*4 dimension but I think It should be 1*1024 dimension in order to plot Q test like T2 testing. I think I miss something. Thanks for your help.
I suspect what you want is diag(R*R'), or equivalently, sum(R.^2,2).
alkan
2009-12-28 08:44:09 UTC
Permalink
Raw Message
On 23 Kasım, 23:02, Peter Perkins
Post by Peter Perkins
Post by alkan alkaya
I could see the T2 plot by using PRINCOMP function but I couldn't plot the Q statistic. I have 1024*4 matrix 4= variables,1024= samples. When I use PCARES function I have RESIDUAL=R with same dimension (1024*4). for Q statistic as I know Q=R'*R after this calculation Q matrix occurs with 4*4 dimension but I think It should be 1*1024 dimension in order to plot Q test like T2 testing. I think I miss something. Thanks for your help.
I suspect what you want is diag(R*R'), or equivalently, sum(R.^2,2).
I can calculate the confidence limit for T^2 test in matlab with
"T2Upper=p*(n-1)/(n-p)*finv(0.98,p,n-p); here p =PCs,n= sample number"
like this how can I calculate the confidence limits for Q test?
alkan alkaya
2009-12-28 08:47:03 UTC
Permalink
Raw Message
I can calculate the confidence limit for T^2 test in matlab with
"T2Upper=p*(n-1)/(n-p)*finv(0.98,p,n-p); here p =PCs,n= sample number"
like this how can I calculate the confidence limits for Q test?
zhou
2014-11-19 14:11:09 UTC
Permalink
Raw Message
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Now I have the same problem, I can't compute the Q statistics. Hope your help. Thank you very much.
Shashank
2015-08-16 05:26:03 UTC
Permalink
Raw Message
Post by zhou
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Now I have the same problem, I can't compute the Q statistics. Hope your help. Thank you very much.
I did this, please cross-check: I have a N by 2 data matrix 'A', 2 = variables = Voltage, current. I retained only the 1st principal component obtained from princomp. Then I got the residuals matrix 'residuals' from pcares(A,1); after that---- I did Qr = residuals'*residuals--this gave me a 2*2 matrix; For 98% confidence interval upper limit, i found Qalpha =P/2m*chi2inv(0.98,V):-
where, P = var(Qr(:,1)), m = mean (Qr(:,1)), V=(2*(m^2))/p;
Stephen Murray
2017-04-04 14:29:03 UTC
Permalink
Raw Message
Post by zhou
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Now I have the same problem, I can't compute the Q statistics. Hope your help. Thank you very much.
I know this thread has lain fallow for a long time, but Ive been struggling with this myself, and because of the variety of different notation schemes and equations in different papers and books, Ive decided to try and pitch in.

Assume x is a data matrix with rows as observations, and columns as system variables. P is a loading matrix that can be calculated usign pca.m

In order to calculate the errors (e), you can use pcares.m, or alternatively:

e = x* (eye(size(x,2)) - P(:,1:N)*P(:,1:N)' ); % (use both and check result) N is number of retained components

Q = e*e' ; % this gives an nx1 vector of q-stat corresponding to each column

To find an upper control limit for Q:

theta1 = trace(e*e'/(size(x,1)-1));
theta2 = trace((e*e'/(size(x,1)-1)).^2);
theta3 = trace((e*e'/(size(x,1)-1)).^3);
h0 = 1 - (2*theta1*theta3)/(3*theta2^2);
ca=2.57; % standard deviate for alpha=0.01
Qa = theta1*( ca*sqrt(2*theta2*h0^2)/theta1 + 1 + (theta2*h0*(h0-1))/(theta1^2))^(1/h0);

To check if this works, compare your Q vector against Qa; youll expect about 2% of your results to be greater than Qa


Source: This Paper
http://www.ans.org/pubs/journals/nt/a_3240
Kaistha & Upadhyaya: Incipient Fault Detection and Isolation of Field Devices in Nuclear Power Systems Using Principal Component Analysis
Stephen Murray
2017-04-04 14:57:03 UTC
Permalink
Raw Message
Post by Stephen Murray
Post by zhou
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Now I have the same problem, I can't compute the Q statistics. Hope your help. Thank you very much.
I know this thread has lain fallow for a long time, but Ive been struggling with this myself, and because of the variety of different notation schemes and equations in different papers and books, Ive decided to try and pitch in.
Assume x is a data matrix with rows as observations, and columns as system variables. P is a loading matrix that can be calculated usign pca.m
e = x* (eye(size(x,2)) - P(:,1:N)*P(:,1:N)' ); % (use both and check result) N is number of retained components
Q = e*e' ; % this gives an nx1 vector of q-stat corresponding to each column
theta1 = trace(e*e'/(size(x,1)-1));
theta2 = trace((e*e'/(size(x,1)-1)).^2);
theta3 = trace((e*e'/(size(x,1)-1)).^3);
h0 = 1 - (2*theta1*theta3)/(3*theta2^2);
ca=2.57; % standard deviate for alpha=0.01
Qa = theta1*( ca*sqrt(2*theta2*h0^2)/theta1 + 1 + (theta2*h0*(h0-1))/(theta1^2))^(1/h0);
To check if this works, compare your Q vector against Qa; youll expect about 2% of your results to be greater than Qa
Source: This Paper
http://www.ans.org/pubs/journals/nt/a_3240
Kaistha & Upadhyaya: Incipient Fault Detection and Isolation of Field Devices in Nuclear Power Systems Using Principal Component Analysis
CORRECTION
- dont use e, this is reserved by MATLAB, use something liuke err instead
- Q = e*e' ; should read Q = diag(e*e') ;
Rafael Lima
2017-05-31 21:40:58 UTC
Permalink
Raw Message
Post by Stephen Murray
Post by Stephen Murray
Post by zhou
Post by Peter Perkins
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
The PRINCOMP function in the Statistics Toolbox returns the T^2 statistics; the PCARES function returns residuals that are used to compute the Q statistics. Hope this helps.
Now I have the same problem, I can't compute the Q statistics. Hope your help. Thank you very much.
I know this thread has lain fallow for a long time, but Ive been struggling with this myself, and because of the variety of different notation schemes and equations in different papers and books, Ive decided to try and pitch in.
Assume x is a data matrix with rows as observations, and columns as system variables. P is a loading matrix that can be calculated usign pca.m
e = x* (eye(size(x,2)) - P(:,1:N)*P(:,1:N)' ); % (use both and check result) N is number of retained components
Q = e*e' ; % this gives an nx1 vector of q-stat corresponding to each column
theta1 = trace(e*e'/(size(x,1)-1));
theta2 = trace((e*e'/(size(x,1)-1)).^2);
theta3 = trace((e*e'/(size(x,1)-1)).^3);
h0 = 1 - (2*theta1*theta3)/(3*theta2^2);
ca=2.57; % standard deviate for alpha=0.01
Qa = theta1*( ca*sqrt(2*theta2*h0^2)/theta1 + 1 + (theta2*h0*(h0-1))/(theta1^2))^(1/h0);
To check if this works, compare your Q vector against Qa; youll expect about 2% of your results to be greater than Qa
Source: This Paper
http://www.ans.org/pubs/journals/nt/a_3240
Kaistha & Upadhyaya: Incipient Fault Detection and Isolation of Field Devices in Nuclear Power Systems Using Principal Component Analysis
CORRECTION
- dont use e, this is reserved by MATLAB, use something liuke err instead
- Q = e*e' ; should read Q = diag(e*e') ;
Mr. Murray,
you've wrote that:
"> > ca=2.57; % standard deviate for alpha=0.01"

Do you know which Matlab command does this calculation? I would like to compute ca for all "alphas" inside the interval [0 1] (most precisely: (0:0.01:1)).

Thank you in advance.
m***@gmail.com
2018-03-07 08:42:14 UTC
Permalink
Raw Message
ca=norminv(p,m,sigma); %%m=mean and sigma=standard deviation

a***@student.lboro.ac.uk
2013-08-15 17:25:46 UTC
Permalink
Raw Message
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
Just wanted to ask, what is SPE stands for?
p***@gmail.com
2017-05-31 21:22:59 UTC
Permalink
Raw Message
Post by a***@student.lboro.ac.uk
Post by alkan alkaya
I want to use PCA (Principle component analysis) Q and T statistics test for fault detection control process. How can I use and how can I plot the Q or T2 statistics of the measured data?
Just wanted to ask, what is SPE stands for?
Squared Prediction Error
Loading...