Regression Residuals from a Matrix/ Autocorrelation/ Durbin Watson Test

3 ビュー (過去 30 日間)
stefan strasser
stefan strasser 2012 年 12 月 6 日
Hello guys, I need to retrieve residuals of a regression in order to do a durbin watson test. the dataset "returns" is 73 columns and 8772 rows. cols are different assets and rows are observations. using the following code it does not loop through all assets… How do i need to change that loop so it goes through all columns and i arrive at retrieving the residuals of the dimension 73 columns 8771 lines?
returns=price2ret(energy);
noofassets=size(returns,2);
for i=1:noofassets
[b,bint,r,rint]=regress(returns(2:end,i),[ones(size(returns,1)-1,1) returns(1:(end-1),i)]);
resids(:,i)=r;
end % end i
Thank you very much for your help!! Stefan

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by