Exclude where actuals exist
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Exclude where actuals exist
Hi,
I am working with some forecasts and some of these will be conditioned upon various things. For this, I would like to check the option "For all other endogenous - Exclude for periods where actuals exist" under Model -> Scenarios -> Excludes. I can't seem to find how to do this in the Object reference, and doing all these forecasts manually would be very tedious so if anyone knows if it is possible and how it can be done that would be very helpful. I would guess that one option is to make a separate model, check the box and then use the modelname.scenario(i="modelname2") command to copy the excludes/overrides settings from modelname2. But a program where it is done directly would be nicer.
I'd be grateful for any help!
I am working with some forecasts and some of these will be conditioned upon various things. For this, I would like to check the option "For all other endogenous - Exclude for periods where actuals exist" under Model -> Scenarios -> Excludes. I can't seem to find how to do this in the Object reference, and doing all these forecasts manually would be very tedious so if anyone knows if it is possible and how it can be done that would be very helpful. I would guess that one option is to make a separate model, check the box and then use the modelname.scenario(i="modelname2") command to copy the excludes/overrides settings from modelname2. But a program where it is done directly would be nicer.
I'd be grateful for any help!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Exclude where actuals exist
Code: Select all
model.exclude(actexist=t) y1
Re: Exclude where actuals exist
Thanks a lot! That worked perfectly. I had completely missed the .exclude command, funny how it's so easy to completely overlook certain things...
Re: Exclude where actuals exist
Another question: I'm making some forecasts for the unemployment rate, which I then insert in a table. Since it's unemployment I don't really need all six decimals (only one would be enough). I googled a bit and found a tip to use @round(x*10)/10 to round it to one decimal. The values in the table still have six decimals though, but instead of 8.188763 it's 8.20000. How do I reduce the number of decimals shown so it'd only be 8.2?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Exclude where actuals exist
How are you inserting the numbers into the table?
Re: Exclude where actuals exist
The code is pretty long and I don't have it here right now (not at work), but the principle is like in this picture:

I have outcomes for 2011Q1-2012Q1, so using a string variable in the beginning defined like: %realgdp = "100 110 120 130 140" I use @wcount and @val to get the right value in the right row. So the rows 2011Q1-2012Q1 are the same for all models. I have it set up like that so this can be used easily in the future; the code is written in a very general manner so people not familiar with programming can use it later on without me. I then use my forecasted GDP growth rates to calculate 2012Q2, 2012Q3, ... , 2014Q4 in terms of real GDP. These are then summed up into the second part of the table as seen in the picture. Using these sums, the annual growth rates are calculated in the third part of the table. Exactly how it's done I can show you in the morning if it's relevant, but it should be fairly straight-forward except for all the substitution variables used. It's this third part of the table I'd like to only have one decimal, the rest I don't care so much about. But basically the insertions in those rows are just percentage change calculations.

I have outcomes for 2011Q1-2012Q1, so using a string variable in the beginning defined like: %realgdp = "100 110 120 130 140" I use @wcount and @val to get the right value in the right row. So the rows 2011Q1-2012Q1 are the same for all models. I have it set up like that so this can be used easily in the future; the code is written in a very general manner so people not familiar with programming can use it later on without me. I then use my forecasted GDP growth rates to calculate 2012Q2, 2012Q3, ... , 2014Q4 in terms of real GDP. These are then summed up into the second part of the table as seen in the picture. Using these sums, the annual growth rates are calculated in the third part of the table. Exactly how it's done I can show you in the morning if it's relevant, but it should be fairly straight-forward except for all the substitution variables used. It's this third part of the table I'd like to only have one decimal, the rest I don't care so much about. But basically the insertions in those rows are just percentage change calculations.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Exclude where actuals exist
Well, I'm not sure if you're using the @str function to convert a number into a string prior to putting it into the table, but if you are, the @str function allows you to set a format.
@str(!num, "f.1") is the format for one decimal place.
@str(!num, "f.1") is the format for one decimal place.
Re: Exclude where actuals exist
The relevant part of the code looks like this:
annualbnp is the table name
The addition of what you suggested (I changed my mind and went with two decimals instead) in this line:
did the trick. Thank you!
annualbnp is the table name
Code: Select all
%lastprog="last quarter for forecast"
%firstbnp="the first quarter for the real GDP observations manually supplied in a different string"
'To find where the first part of the table ends:
!tom=2
while @isempty(annualbnp(!tom, 1))=0
!tom=!tom+1
wend
'To find where the second part of the table ends:
!empty=!tom+1
while @isempty(annualbnp(!empty,1))=0
!empty=!empty+1
wend
'Calculating the annual growth rates. The number of years this number is calculated for is found through counting the number of quarters supplied in the table minus one year.
for !k=0 to (@dtoo(%lastprog)-@dtoo(%firstbnp)+1)/4-2
annualbnp(!empty+1+!k, 1+!f)=@str(((@val(annualbnp(!tom+2+!k, 1+!f))-@val(annualbnp(!tom+1+!k, 1+!f)))/@val(annualbnp(!tom+1+!k, 1+!f))*100), "f.2")
next
Code: Select all
annualbnp(!empty+1+!k, 1+!f)=@str(((@val(annualbnp(!tom+2+!k, 1+!f))-@val(annualbnp(!tom+1+!k, 1+!f)))/@val(annualbnp(!tom+1+!k, 1+!f))*100), "f.2")Re: Exclude where actuals exist
Okay, I'm back for another question.
In my forecast evaluation program I use this at one point:
The !a loop cycles through my models and !b is for the rolling forecasting scheme. The problem is that the @command may or may not be causing some problems. If I run this is in a separate program (i.e. not in the rather long forecasting program) and save the individual %com strings in an alpha series, I get the following:
The issue is that the correct specification should be: "... @ c bnptcw(-1 to -4)" (some should also have dummies). The exogenous variables seem to disappear. However, looking at the Estimation Specification for each model they are as they should be, BUT clicking on Estimate and looking at the VAR Specification window the only exogenous variable in all of the equations is the constant c. I'm not sure what's going on and if the re-estimations of my models in the rolling forecasting scheme are performed correctly or not. Do you have any idea what the reason is for this and how I can make sure it's done correctly?
In my forecast evaluation program I use this at one point:
Code: Select all
%varlist=@wlookup("*","var")
for !a=1 to @wcount(%varlist)
%var = @word(%varlist,!a)
...
for !b=0 to @dtoo("2012Q1")-@dtoo("2005Q4")-!step
smpl 1990Q4 2005Q4+!b
%com={%var}.@command
{%var}.{%com}
...
next
next
Code: Select all
LS 1 4 CPIX ALOSH BNP LD_SSVX KIX @
LS 1 4 CPIX ALOSH BNP FGAP LD_SSVX KIX @
LS 1 4 CPIX ALOSH BNP FGAP LD_UTLANR KIX SI @
LS 1 4 CPIX ALOSH BNP FGAP LD_UTLANR KIX @
LS 1 4 CPIX ALOSH BNP LD_SSVX KIX SI @
LS 1 4 CPIX ALOSH BNP LD_UTLANR KIX @
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Exclude where actuals exist
I can't see anything wrong with what you're doing. Further, I just ran a test program using your code, and it appears to work:
Code: Select all
create q 1985 2012
series cpix = rnd
series alosh=rnd
series bnp=nrnd
series ld_ssvx=nrnd
series kix=nrnd
series fgap=nrnd
series ld_utlanr=nrnd
series si=nrnd
series bnptcw=nrnd
var v1.LS 1 4 CPIX ALOSH BNP LD_SSVX KIX @ c bnptcw(-1 to -4)
var v2.LS 1 4 CPIX ALOSH BNP FGAP LD_SSVX KIX @ c bnptcw(-1 to -4)
var v3.LS 1 4 CPIX ALOSH BNP FGAP LD_UTLANR KIX SI @ c bnptcw(-1 to -4)
var v4.LS 1 4 CPIX ALOSH BNP FGAP LD_UTLANR KIX @ c bnptcw(-1 to -4)
var v5.LS 1 4 CPIX ALOSH BNP LD_SSVX KIX SI @ c bnptcw(-1 to -4)
var v6.LS 1 4 CPIX ALOSH BNP LD_UTLANR KIX @ c bnptcw(-1 to -4)
!step = 1
'''''''''''''''''''''''''''''''''''-------------------------------------------------------------------------
%varlist=@wlookup("*","var")
for !a=1 to @wcount(%varlist)
%var = @word(%varlist,!a)
for !b=0 to @dtoo("2012Q1")-@dtoo("2005Q4")-!step
smpl 1990Q4 2005Q4+!b
%com={%var}.@command
{%var}.{%com}
next
next
Re: Exclude where actuals exist
Yes, I just ran what you posted and added an alpha series to store the %com strings in and it looked like it should. Must be something else in my code then, though I also think it is working as it should (i.e. doing what it should) because the last estimation output of every equation includes the exogenous variable and I'd assume that all rolling estimations prior to that would include it too then. Thanks for the help!
Who is online
Users browsing this forum: No registered users and 2 guests
