Estimation using smpl command

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Kouvas
Posts: 34
Joined: Sat Aug 31, 2013 3:28 am

Estimation using smpl command

Postby Kouvas » Sat Dec 28, 2013 8:46 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Estimation using smpl command

Postby EViews Gareth » Sat Dec 28, 2013 9:02 am

Setting the sample should be instant. How do you know it is taking a long time

Kouvas
Posts: 34
Joined: Sat Aug 31, 2013 3:28 am

Re: Estimation using smpl command

Postby Kouvas » Sat Dec 28, 2013 9:21 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Estimation using smpl command

Postby EViews Gareth » Sat Dec 28, 2013 10:07 am

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.

Kouvas
Posts: 34
Joined: Sat Aug 31, 2013 3:28 am

Re: Estimation using smpl command

Postby Kouvas » Sat Dec 28, 2013 10:14 am

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

Postby EViews Gareth » Sat Dec 28, 2013 11:08 am

Sure, but you're calculating @obs four times for each cross-section.

Kouvas
Posts: 34
Joined: Sat Aug 31, 2013 3:28 am

Re: Estimation using smpl command

Postby Kouvas » Sat Dec 28, 2013 11:15 am

Oh yes you are right, thanks a lot!!

Best

Kouvas


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests