Box Cox Autoarma Error

For questions regarding programming in the EViews programming language.

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

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Box Cox Autoarma Error

Postby BCNAV » Wed Dec 27, 2017 1:58 pm

I've been using:

freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=auto,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast

without issue.

However, when choosing the transform as Box-Cox (tform=bc, bc=2) I get errors stating "Attempt to raise a negative number to a non integer power". What is going on here? I have written a program that will find "optimal" lambdas and would like to use it, but even with the standard options I get this error.

Any ideas? Thanks

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Wed Dec 27, 2017 2:55 pm

Is your copy of EViews up to date?


Seems to work for me:

Code: Select all

wfcreate m 1990 2020
series y=rnd

%series = "y"

!fcst_length=12

smpl 1990 2019



freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=bc, bc=2,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast
Follow us on Twitter @IHSEViews

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Thu Dec 28, 2017 7:43 am

We are using the Enterprise Edition of 10+ Nov 30 2017 Build. Check for update says we are good. Rebooted machine and still the error. Error does not occur when using the GUI. The error only occurs when the tform option changes from tform=auto to tform=bc, bc=2. I plan to pass the lambda to bc with the optimal one found.

Note that if I use bc=1, 0.5, 0, -0.5, -1 are ok.

if lambda is 2 or -2 or higher/lower, EViews fails. With the positive 2 I get the error "Attempt to raise a negative number to a non integer power"
if I se lambda of -2 I get error "^ function given an out of range argument"

Lambdas of 2 and -2 are common, so I am not sure why EViews is bombing at the command line and not the GUI.

The manual says bc=int Set the power of the Box-Cox transformation. Only applicable if the tform=bc option is used.

Again, the GUI handles everything fine.

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Thu Dec 28, 2017 9:24 am

Did you try the code:

Code: Select all

wfcreate m 1990 2020
series y=rnd

%series = "y"

!fcst_length=12

smpl 1990 2019



freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=bc, bc=2,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast
Follow us on Twitter @IHSEViews

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Thu Dec 28, 2017 11:51 am

Well I am totally messed up here...your code worked. I don't see where I am going wrong.

Here is my code. I still get the errors

Code: Select all


close @all
%m=@left(@date,2)   
%d=@mid(@date,4,2)   
!year=2000+@right(@date,2
!annual1=2000
!annual2=2020

%history_end_date="2017.11"
%forecast_start_date="2017.12"
%forecast_end_date="2020.1"
!fcst_length=@datediff(@dateval(%forecast_end_date, "yyyy.mm"),@dateval(%forecast_start_date, "yyyy.mm"),"mm")+1

wfcreate arima_{!year}.{%m}.{%d} u !annual1 !annual2
%wfsaveloc="R:\Eviews\Workfiles\ARIMA\Fees"

pagecreate m !annual1 !annual2
pagerename untitled1 navdat_m
smpl @all


FETCH(d=R:\Eviews\Databases\Main\nav_data_all_ts.edb) ovr_ecu_m11_n ovr_ecu_m14_n ovr_ecu_m22_n ovr_ecu_m23_n
%vars="ovr_ecu_m11_n ovr_ecu_m14_n ovr_ecu_m22_n ovr_ecu_m23_n"

for %series {%vars}
   smpl @first %history_end_date
   freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=bc,bc=2,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast
   {%series}_eq.fit(e) {%series}_fit
next



Don't know why this does not work.

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Thu Dec 28, 2017 12:47 pm

In the EViews database I am using, there are a total of 5 variables that exhibit this behaviour. That is, they cause crashes of EViews form within the program code, but work perfectly within the GUI. I can calculate Box-Cox transforms on my own and they work fine. This is a weird problem, which may be with EViews. Any other insight is great.

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Thu Dec 28, 2017 12:52 pm

Would it be possible for you to provide the data?
Follow us on Twitter @IHSEViews

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Thu Dec 28, 2017 1:13 pm

Yes I can. Workfile is attached (hopefully)
Attachments
GarethTest.WF1
(24.69 KiB) Downloaded 283 times

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Thu Dec 28, 2017 3:14 pm

Can confirm I receive the same error. We'll investigate.
Follow us on Twitter @IHSEViews

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Thu Dec 28, 2017 5:20 pm

Thanks...let me know when you can.

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Thu Dec 28, 2017 5:30 pm

So what's going on is that for the (2,2,0,0) model, the forecast of the transform of the variable goes negative. Then EViews tries to un-do the transformation (which involves taking the square root), and fails, giving the error message.

You could try creating a series that is equal to the Box-Cox transformation of the variable yourself, doing the autoarma on it, selecting the correct model and then undoing the transformation manually. Yes this is a bit of a pain.
Follow us on Twitter @IHSEViews

BCNAV
Posts: 40
Joined: Tue Oct 31, 2017 9:06 am

Re: Box Cox Autoarma Error

Postby BCNAV » Fri Dec 29, 2017 9:31 am

Thanks. I am guessing that autoarma is differencing (this is auto) the Box-Coxed variable and forecasting a drop (negative value) and transforming that negative drop back ("un Box-Cox"). This is problematic with a lambda of 2 (square root of negative number). I guess EViews tries to transform back before making a level forecast? If so, then perhaps it could be altered to take the forecasted change (which is what a difference is), add it to the previous Box-Cox value, then transform the whole thing back.

So my options, if wanting to use a Box-Cox transform are to:

1. Make the transform manually
2. Run autoarma to get the level forecasts (from differences if applicable)
3. Manually un-Box-Cox the forecast back.

This seem ok?

Thanks for your checking.

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

Re: Box Cox Autoarma Error

Postby EViews Gareth » Fri Dec 29, 2017 9:56 am

Right.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 25 guests