Should I use PCA, Factor Analysis or ICA for this problem?

For example, I have this data set:
Apple S&P Barclays Vanguard
3.00 --- 2.1 --- -1.8 ------- 0.5
1.8 ----- 0.2 ----- 2.2 ------ 3.3
-0.7 ---- 3.5 ------ 2.7 ----- -2.5
In this case I need to find out which factors (Index returns) had influenced each Apple's return. Results need to be in a graph that show correlations.
I tried to use PCA following MatLab example "Cities quality of life" but it didn't work because cities are just names, while I have values.
Please help me, it is very urgent.

Answers (1)

Hi Arnold,
To analyze which factors (e.g., S&P, Barclays, Vanguard) influence Apple's returns, you can use multiple linear regression instead of PCA. PCA is used for dimensionality reduction and finding patterns in data, but it doesn't directly show the influence of one variable over another.
Here’s how you can perform this analysis in MATLAB and visualize the results:
  1. Organize your data
  2. Perform Multiple linear regression
  3. Visualise the data
% Example data
data = [
3.00, 2.1, -1.8, 0.5;
1.8, 0.2, 2.2, 3.3;
-0.7, 3.5, 2.7, -2.5
];
% Separate the data
appleReturns = data(:, 1);
indexReturns = data(:, 2:end); % S&P, Barclays, Vanguard
% Fit a linear model
mdl = fitlm(indexReturns, appleReturns);
% Display the results
disp(mdl);
% Extract coefficients and confidence intervals
coefficients = mdl.Coefficients.Estimate;
confIntervals = coefCI(mdl);
% Create a bar graph with error bars
figure;
bar(coefficients(2:end)); % Exclude the intercept
hold on;
errorbar(1:length(coefficients)-1, coefficients(2:end), ...
coefficients(2:end) - confIntervals(2:end, 1), ...
confIntervals(2:end, 2) - coefficients(2:end), 'k', 'linestyle', 'none');
hold off;
% Add labels and title
set(gca, 'xticklabel', {'S&P', 'Barclays', 'Vanguard'});
xlabel('Index');
ylabel('Coefficient');
title('Influence of Indices on Apple Returns');

Categories

Asked:

on 22 Dec 2014

Answered:

on 4 Feb 2025

Community Treasure Hunt

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

Start Hunting!