フィルターのクリア

Problems with regstats: more predictor variables than observations

1 回表示 (過去 30 日間)
Michela
Michela 2016 年 5 月 12 日
編集済み: dpb 2016 年 5 月 12 日
Hello, I have some problems with the calculation of the parameters of a regression. More precisely, I have a sample of N observations (monthly observations) and K assets (the last one is the market) and I need to find the alpha and beta (as the CAPM do:(Rportfolio-Rfree_risk)=(Rmarket-Rfree_risk)beta) for each period (hence, I need to have N alphas and N betas). I have written this function:
function [Alpha,Beta,EqReturns,EqVarCovar]=CAPM(RetMarket,RetAssets,VarMarket)
for k=1:size(RetAssets,1);
for i=1:size(RetAssets,2);
out(k,:)=regstats(RetAssets(k,i),RetMarket(k,:),'linear',{'beta','r','rsquare'});
Alpha(i,k)=out(k,:).beta(1);
Beta(i,k)=out(k,:).beta(2);
R2(i,k)=out(k,:).rsquare;
Resid(k,i)=out(k,:).r;
EqRet(i,k)=out(k,:).beta(2)*(RetMarket(k,:));
end
EqReturns(k,i)=eqret(i,k)';
EqVarCovar(:,:,k)=Beta(:,k)*(Beta(:,k)')*VarCovarMarket(k,:)+diag(diag(cov(Resid(k,:))));
end;
end
where RetMarket is Nx1, RetAssets is NxK and VarMarket is Nx1.
Is there someone who can explain me where is my error?? Thanks!!!

回答 (1 件)

dpb
dpb 2016 年 5 月 12 日
編集済み: dpb 2016 年 5 月 12 日
In
out(k,:)=regstats(RetAssets(k,i),RetMarket(k,:),'linear',{'beta','r','rsquare'});
RetAssets(k,i) is always only a single point and RetMarket(k,:) is also if size(RetMarket) is Nx1 as stated.
To fit a linear regression you'll have to have at least two points for the x and y vectors. In general, of course, one would have at least one extra DOF and generally quite a few more than that.
It's not clear what you would mean for each period; at first I thought you were likely meaning a regression for each of the k "assets" but then you explicitly state N sets of coefficients so I'm at a loss what that would be (unless it's a point-to-point return as compared to the previous month, maybe??? If that were so, it's just a ratio of the two successive values for percentage but if is actually a regression it'd be the specific line between the two point values).

カテゴリ

Help Center および File ExchangeModel Building and Assessment についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by