필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I get the input for several regressions?

조회 수: 1 (최근 30일)
Ana
Ana 2014년 4월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I need to do a regression for every 12 days and I need both the b and hint output of each regression. Until now i have: for i=1:624 [b,bint]=regress(returns(i:i+12,:),regressors(i:i+12,:)); end
but it only gives me the last regression output. Can somebody help me? Thanks :)

답변 (1개)

Star Strider
Star Strider 2014년 4월 28일
Store each as a cell array:
[b{i},bint{i}] = regress( ...
  댓글 수: 2
Ana
Ana 2014년 4월 28일
It still doesn't work. It says "Comma separated list expansion has cell syntax for an array that is not a cell" :(
Star Strider
Star Strider 2014년 4월 28일
편집: Star Strider 2014년 4월 28일
It worked for me when I tried it this morning, else I'd not have posted it.
This is the simulation I ran successfully then and again just now ( R2014a, Win 8 64 ). Run it and see if it works on your computer:
returns = rand(6);
regressors = randi(10,6,6);
for k1 = 1:size(returns,1)/2
x = regressors(k1:k1+1,:)
y = returns(k1,:)
[b{k1},bint{k1}] = regress(returns(k1:k1+1,1),regressors(k1:k1+1,:))
end
b{1}
bint{1}
It gives me all three values of both variables (one for each run). What is you loop counter ‘i’ when it throws that error?
Post the section of your code in your loop that throws the error.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by