フィルターのクリア

PCA shape mode analysis

7 ビュー (過去 30 日間)
Thiwanka Palmada
Thiwanka Palmada 2021 年 11 月 5 日
回答済み: Shubham 2024 年 2 月 16 日
Hi
I am trying to do a PCA analysis on intestine geometries, my data consists of 33 geometries and 400 datapoints per geometry i.e. 20 radii values (equally spaced theta values) along 20 centerpoints
PCA_DATA = [33x400]
I do the PCA analysis using:
[eigenvectors, scores,latent,tsquared,explained,mu] = pca(PCA_DATA);
Now I want to study the physical meaning of significant shape modes by adjusting the mean radii values along the PC axis by two standard deviations. I understand that I need to take an individual eigenvector and multiply it by a factor and then add onto the mu. But how do I include the standard deviations.
I essentially want two vectors of 400 values [1x400] per PCA component where its either an addition or subtraction from the mean.
Thanks
Nadun

回答 (1 件)

Shubham
Shubham 2024 年 2 月 16 日
Hi Thiwanka,
To study the physical meaning of significant shape modes by adjusting the mean radii values along the principal component (PC) axis by two standard deviations, you can follow these steps:
  1. Determine the standard deviation for each principal component.
  2. Scale the eigenvectors by two standard deviations.
  3. Add and subtract the scaled eigenvectors from the mean to get the new vectors representing the shape modes.
The standard deviation for each principal component is the square root of the corresponding eigenvalue (found in the latent variable). The latent variable contains variances (eigenvalues of the covariance matrix), so to get the standard deviation, you take the square root.
% Perform PCA analysis
[eigenvectors, scores, latent, tsquared, explained, mu] = pca(PCA_DATA);
% Calculate the standard deviations for the PCs
std_devs = sqrt(latent);
% Choose the number of principal components you want to analyze
numPCs = 3; % For example, let's take the first 3 PCs
% Initialize arrays to store the adjusted shapes
adjusted_shapes_plus = zeros(numPCs, size(PCA_DATA, 2));
adjusted_shapes_minus = zeros(numPCs, size(PCA_DATA, 2));
% Calculate the adjusted shapes by adding/subtracting two standard deviations along each PC
for i = 1:numPCs
% Scale the eigenvector by two standard deviations
scaled_eigenvector = 2 * std_devs(i) * eigenvectors(:, i);
% Add and subtract the scaled eigenvector from the mean
adjusted_shapes_plus(i, :) = mu + scaled_eigenvector';
adjusted_shapes_minus(i, :) = mu - scaled_eigenvector';
end
% Now you have two sets of adjusted shapes for each of the first numPCs components
% adjusted_shapes_plus and adjusted_shapes_minus are [numPCs x 400] matrices
% Each row corresponds to the mean adjusted by +/- two standard deviations along a PC
After running this code, for each principal component you've chosen to analyze (in this case, the first three), you will have a pair of 400-value vectors (adjusted_shapes_plus and adjusted_shapes_minus). Each pair represents the geometry adjusted by +2 and -2 standard deviations along the corresponding principal component axis. You can then examine these vectors to understand the physical meaning of the significant shape modes in your data.

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by