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
Betas loop regression
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Betas loop regression
You can't use two loops like that.
Try this:
Try this:
Code: Select all
coef(3) betas
!i=1
for %stocks mcd sbux cat
equation stock{%stocks}.ls d({%stocks})=c(1)+c(2)*d(spy)
betas(!i)=stock{%stocks}.@coef(2)
!i=!i+1
next
Who is online
Users browsing this forum: No registered users and 1 guest
