I'm trying to use T-squared distribution (by hand) in my pca analysis. It's purpose is diagnostics after dimensional reduction.
M=self.PCA_red.shape[1]
N=self.PCA_red.shape[0]
F=scipy.stats.f.ppf(0.95,M,N-M)
self.T2lim=(M*(N-1)/(N-M))*F
for i in range(self.PCA_red.shape[0]):
self.T2.append(self.PCA_red[i].dot(inv(self.cov_mat)).dot(self.PCA_red[i].T))
PCA_red is reduced data from (236,8) to (236,4) so first covariance matrix had (8,8). How do I calculate a new covariance matrix T-squared distribution? Should I calculate it from reduced data? Could someone explain that to me?