Conditional sampling within a model object?

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Conditional sampling within a model object?

Postby bhaupt » Mon Jun 18, 2012 8:49 am

In a standard databanking routine I apply a lag effect to a discrete distribution to create several of my model inputs. Recently I have moved from using a single response curve to using a set of response curves with seasonal differences (Holiday and Non-Holiday). To explain the historical data, this has worked well; however, when working with forecasted assumptions, there appears to be no way to take a model object and apply the same logic.

Steps that I used to do:
1. Input_Series_LAG = Input Series_RAW * Input_Series_ResponseCurve + Input Series_RAW(-1) * Input_Series_ResponseCurve(1) + ... + Input Series_RAW(-n) * Input_Series_ResponseCurve(n)
2. In the model object for the Forecast, the ResponseCurve values were just put in by hand (long equation, but it worked)

Steps that I do now:
1. Input_Series_RAW_NH = Input_Series_RAW for a smpl @all if @month == m1 or @month = m2 {m1 and m2 are months in the NH period}
2. Input_Series_RAW_HD = Input_Series_RAW for a smpl @all if @month == m3 or @month = m4 {m3 and m4 are months in the HD period}
3. Input_Series_LAG_NH = Input Series_RAW_NH * Input_Series_ResponseCurve_NH + Input Series_RAW_NH(-1) * Input_Series_ResponseCurve_NH(1) + ... + Input Series_RAW_NH(-n) * Input_Series_ResponseCurve_NH(n)
3. Input_Series_LAG_HD = Input Series_RAW_HD * Input_Series_ResponseCurve_HD + Input Series_RAW_HD(-1) * Input_Series_ResponseCurve_HD(1) + ... + Input Series_RAW_HD(-n) * Input_Series_ResponseCurve_HD(n)
4. Input_Series_LAG = Input_Series_LAG_NH + Input_Series_LAG_HD (done as a group and a @rsum)

In the model object, I can't have an equation based on conditional sampling (or can I?, and if so, how?) so the original methodology breaks down, and my forecast assumptions either have to be hard coded or turned into some monstrosity I haven't wrapped my head around yet.

Looking at this, my question is really how do I make the Input_Series_RAW assumptions separate into two time dependent equations, so that if a different scenario assumption for Input_Series_RAW is put into place that the equation can handle the change?

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Conditional sampling within a model object?

Postby EViews Chris » Mon Jun 18, 2012 10:28 am

Not sure I'm exactly following what is going on in your example, but most 'sample if' style statements can be reformulated as one or more equations that use the '@iif' function (also known as '@recode') which has the form:

@iif( logical condition, value if true, value if false)

So, for example:

input_series_raw_nh = @iif(@month=m1 or @month=m2, input_series_raw, NA)

will set input_series_raw_nh to input_series_raw if @month is equal to m1 or m2 and to NA if it is not.

Not sure if there is something more complicated going on in your world because of lags, but hopefully this gives you something to look into.

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: Conditional sampling within a model object?

Postby bhaupt » Mon Jun 18, 2012 10:43 am

Excellent! I'm making the changes to the older equations and I'll give it a go. I'll let you know how it works. Thank you!

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: Conditional sampling within a model object?

Postby bhaupt » Tue Jun 19, 2012 8:46 am

This worked perfectly. The sub-model takes forecast inputs, segments by holdiay and non-holiday, lags each properly, combines them back to the appropriate series, and provides usable inputs for the model. Incorporating @iif into the structure was exactly what was needed.

With that said, at the end I am adding the Holiday and Non-Holiday series together to create the final series. If there is (somehow) an NA the series, it will propogate through, which in this case would be undesireable. Is there an equivalent to @rsum that will work within an equation or model object?


Return to “Models”

Who is online

Users browsing this forum: No registered users and 7 guests