Hello there
I am trying to estimate a specific annual measure using a time series that has a weekly frequency. For that reason I use summation over the year. My problem is that the command smpl that I use takes a lot of time to execute. Is there an alterbative way? Thank you in advance.
Best
Kouvas
Estimation using smpl command
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: Estimation using smpl command
Setting the sample should be instant. How do you know it is taking a long time
Re: Estimation using smpl command
The code is the following:
for !t=1 to !years
!tyear=1986+!t
for !n=1 to !firms
statusline !n_!t
smpl !tyear !tyear if crossid=!n
if @obs(ret_new)>26 then
matncskew(!t,!n)=-((@obs(ret_new)*((@obs(ret_new)-1)^(3/2))*@sum(ret_new^3))/((@obs(ret_new)-1)*(@obs(ret_new)-2)*((@sum(ret_new^2))^(3/2))))
matextra_sigma(!t,!n)=-@min((ret_new-@mean(ret_new))/@stdev(ret_new))
endif
next
next
it is executed annually (30 years) for 4500 cross-sections. It takes a lot of time to calculate the two needed matrices (matncskew and matextra_sigma). Is there another way to calculate the above matrices?
Moreover it also has the following error :"series raised to scalar". Any help on those problems would be very very much appriciated!
Best
Kouvas
for !t=1 to !years
!tyear=1986+!t
for !n=1 to !firms
statusline !n_!t
smpl !tyear !tyear if crossid=!n
if @obs(ret_new)>26 then
matncskew(!t,!n)=-((@obs(ret_new)*((@obs(ret_new)-1)^(3/2))*@sum(ret_new^3))/((@obs(ret_new)-1)*(@obs(ret_new)-2)*((@sum(ret_new^2))^(3/2))))
matextra_sigma(!t,!n)=-@min((ret_new-@mean(ret_new))/@stdev(ret_new))
endif
next
next
it is executed annually (30 years) for 4500 cross-sections. It takes a lot of time to calculate the two needed matrices (matncskew and matextra_sigma). Is there another way to calculate the above matrices?
Moreover it also has the following error :"series raised to scalar". Any help on those problems would be very very much appriciated!
Best
Kouvas
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation using smpl command
And obvious way to speed things up is to only perform calculations once. You appear to be calculating @obs and @sum many times in the overall calculation.
Note that I seriously doubt it is the smpl statement that is taking a long time, as you initially stated.
Note that I seriously doubt it is the smpl statement that is taking a long time, as you initially stated.
Re: Estimation using smpl command
Thanks for your prompt reply Gareth. I think that since I need the number of observations and the sum of the weekly returns for each firm and for each year it has to be calculated each time. I unstuck the data into a new worksheet and it seems to work prety fast.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation using smpl command
Sure, but you're calculating @obs four times for each cross-section.
Re: Estimation using smpl command
Oh yes you are right, thanks a lot!!
Best
Kouvas
Best
Kouvas
Who is online
Users browsing this forum: No registered users and 2 guests
