필터 지우기
필터 지우기

Time series regression for 25 portfolios

조회 수: 2 (최근 30일)
Louisa pauen
Louisa pauen 2017년 11월 2일
답변: magate 2017년 12월 29일
Hello, I want to conduct a time series regression for 25 portfolios to obtain the CAPM betas and alphas. I use a loop for the 25 portfolios and the fitlm function. But I always get a 1x1 linear model and not one for each of the 25 portfolios (so only one alpha and beta value). Here my code: beta = zeros(size(Excess_Returns,2),size(Market_Excess_Return,2));
for i=1:size(Excess_Returns,2)% count of portfolios mdl = fitlm(Market_Excess_Return, Excess_Returns(:,i)) alpha = mdl.Coefficients.Estimates beta = mdl.Coefficients.Estimate(2:end) end so at the end I want to have 25 alpha and 25 beta values with their test statistics! Could anyone help me, what is wrong in my code? Thank you very much in advance!

답변 (1개)

magate
magate 2017년 12월 29일
Are you running a loop and not indexing the variable you are filling? Essentially overwriting the value each loop iteration?
Can you post a cleaner version of your code?

카테고리

Help CenterFile Exchange에서 Multivariate Normal Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by