For loop in linear regression for number of assets
Show older comments
Hello!
I need to build linear regressions for variety of assets (more than 50) to get coefficients, pValues and Rsqured for each assets
My code is
X = Indreturn; %(historical data of market index returns)
Y=EFreturn(:,:); %(historical data of assests — 56 equity funds' returns)
for index = 1:56
md = fitlm(X,Y(:,index));
end
The problem is that I have linear regression output only for the last 56th fund as if I just write
y56 = EFreturn(:,56);
x = Indreturn;
md56=fitlm(x,y56);
I can do it 56 times for each asset of course, but I would like to know how to optimise this process and save time.
Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics and Insights in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!