Betas loop regression
Posted: Wed Oct 15, 2014 7:54 am
Hi, I am trying to run a program whereby I will try to capture in a coef vector the betas of a stock return vs sp500 index returns.
However, I can t retain but the last regression beta in my vector. Any help on the issue is much appreciated! Pls check below the code
BR
coef(3) betas
for %stocks mcd sbux cat
for !i=1 to 3
equation stock{%stocks}.ls d({%stocks})=c(1)+c(2)*d(spy)
betas(!i)=stock{%stocks}.@coef(2)
next
next
However, I can t retain but the last regression beta in my vector. Any help on the issue is much appreciated! Pls check below the code
BR
coef(3) betas
for %stocks mcd sbux cat
for !i=1 to 3
equation stock{%stocks}.ls d({%stocks})=c(1)+c(2)*d(spy)
betas(!i)=stock{%stocks}.@coef(2)
next
next