Substituting observations for indpt. var. after estimation

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

random_eviews_user
Posts: 4
Joined: Fri Apr 03, 2015 7:21 am

Substituting observations for indpt. var. after estimation

Postby random_eviews_user » Fri Apr 03, 2015 7:44 am

Hi all,

Right now I have run a regression that for all intents and purposes looks like this:

sales = c+ B*temperature + u

I ran the regression using actual data to obtain B_hat, but now I want to plug in "normal" temperature into the estimated equation to see what sales would have been like had weather been "normal". Basically I want to estimate sales with the equation:

sales_normal = c + B_hat* norm_temp

Can anyone guide me through this process. Also, I'd rather not export my coefficients to Excel because I have an AR term (and other explanatory variables) in my regression, and that would get messy.

I am using Eviews 8

Thanks

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

Re: Substituting observations for indpt. var. after estimati

Postby EViews Gareth » Fri Apr 03, 2015 8:41 am

You'll have to use a model to do it. You need to make a model with your equation in it, then override the temperature series with the normal one, and solve
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Substituting observations for indpt. var. after estimati

Postby startz » Fri Apr 03, 2015 9:11 am

random_eviews_user wrote:Hi all,

Right now I have run a regression that for all intents and purposes looks like this:

sales = c+ B*temperature + u

I ran the regression using actual data to obtain B_hat, but now I want to plug in "normal" temperature into the estimated equation to see what sales would have been like had weather been "normal". Basically I want to estimate sales with the equation:

sales_normal = c + B_hat* norm_temp

Can anyone guide me through this process. Also, I'd rather not export my coefficients to Excel because I have an AR term (and other explanatory variables) in my regression, and that would get messy.

I am using Eviews 8

Thanks

Gareth has told you the smart way to solve the problem, but if your problem is simple enough there may be a dumb, but satisfactory, approach.

Suppose you have 100 observations on temperature and want to forecast for 23 values of norm_temp. Set up a workfile with 123 observations with sales and temperature in the first 100. Then copy and paste norm_temp into the last 23 spots in the temperature series. Set the sample to 1 100 and estimate the equation. Then choose the forecast tab in the estimation output and change the forecast sample to 101 123 and the forecast name to sales_normal. That oughta give you what you want.

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

Re: Substituting observations for indpt. var. after estimati

Postby EViews Gareth » Fri Apr 03, 2015 9:49 am

The fact that there are AR terms means that time is an important element in his equation. Adding twenty three observations of temperature in an arbitrary order will probably not work in that case.
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Substituting observations for indpt. var. after estimati

Postby startz » Fri Apr 03, 2015 9:53 am

True.

I'm curious, if you have an AR term and override according to your earlier suggestion, how does the model facility handle the serial correlation? Just not make an forecast for the first period with the overridden data?

random_eviews_user
Posts: 4
Joined: Fri Apr 03, 2015 7:21 am

Re: Substituting observations for indpt. var. after estimati

Postby random_eviews_user » Fri Apr 03, 2015 10:49 am

EViews Gareth wrote:You'll have to use a model to do it. You need to make a model with your equation in it, then override the temperature series with the normal one, and solve


Thanks, Gareth. That said, how do I go about overriding the temperature series. That's the key mechanic I'm missing. In honesty, I'm pretty new to Eviews, so I'm not aware of a lot of the functionality.

As for the other comments, in addition to difficulties incorporating the AR term, I don't think my data structure will allow for easy copy pasting because it is hourly and I plan on doing a comparative backcast for a year as well.

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

Re: Substituting observations for indpt. var. after estimati

Postby EViews Gareth » Fri Apr 03, 2015 12:15 pm

On the variables view of the model, right click on the temperature series and select override.
Follow us on Twitter @IHSEViews

random_eviews_user
Posts: 4
Joined: Fri Apr 03, 2015 7:21 am

Re: Substituting observations for indpt. var. after estimati

Postby random_eviews_user » Mon Apr 06, 2015 7:09 am

Ok, so I have created a scenario within my model, I've named it "normal". I right-clicked my temperature series and the only override option I saw was "Edit Override". As far as I can tell, this is for manual adjustments. I tried reading through the manual on this, but wasn't able to find anything telling me how to insert values from another variable in my workfile. I then decided to just go ahead and overwrite/replace value from my temperature variable to my normal temperature for the last year only.... but my variable within the scenario only shows me observations up through 2013. My workfile has the sample set from 2007 up to the beginning of 2015. My regression has the same sample. Even more, it shows me the last hour of 2013 and the first hour of 2015, but not a single hour of 2014. Can anyone explain why this might be happening, or what to do?

EDIT: I must have set the sample the sample to exclude 2014 earlier and forgot to remove the stipulation. I've changed that now. I'll go about manually plugging in the data, but it would still be nice to simply choose from a variable rather than copy/paste, so if anyone can help on that I would greatly appreciate it.

random_eviews_user
Posts: 4
Joined: Fri Apr 03, 2015 7:21 am

Re: Substituting observations for indpt. var. after estimati

Postby random_eviews_user » Mon Apr 06, 2015 11:37 am

Okay, after much searching and hair pulling, the problem has been solved... mostly. This post is for posterity.

In order to create a separate model estimation using a different set of values for a given exogenous variable, I first had to take my regression Equation and make it into a Model. I did this by opening my Equation, clicking Proc, and then click Make Model. Once within the Model, I needed to create a Scenario in order to Override the values of the the given exogenous variable, while still preserving the estimated coefficient from the Baseline scenario. I did this by opening my Model from within the workfile, clicking View, and then clicking Scenarios.... I then created a new scenario where I would Override my exogenous variable of choice. Once in the new scenario, I right-clicked my variable and clicked Edit Override. Here, the first listed variable is what is know as the Alias. The Alias is the variable that will replace the values of you exogenous variable. If your variable is "var", then the Alias will be "var_1". I manually pasted in the values for the alias. You can see the difference between the Alias values and the Baseline values (if it exists) in cells with red highlighting. This is a good check to see if the changes actually went through. From there I clicked out of the window (I deleted the untitled group which had no effect on the scenario), and from there I clicked Solve. All variables that are affected by the scenario change are given Alias numbering for the scenario, meaning that the Model output can be obtained as a Series from your workfile. If your endogenous variable is "y_var" then the output you want is now listed as "y_var_1" for your first scenario.

I type that out because it took me longer than I care to admit to find out where I could get my model output. Hopefully anyone who encounters this problem in the future will run in to this submission and get the answer they are looking for.

Thanks, Gareth, for the help.

rbebczuk
Posts: 4
Joined: Wed Jan 12, 2022 8:10 am

Scenario override unrecognized

Postby rbebczuk » Thu Mar 24, 2022 7:11 pm

Hi everybody, in case somebody has any tips on this (Gareth maybe?), I´m running a model where I´m trying to override the baseline scenario for my exogenous variables (with a suffix _esc1) with an alternative one (esc2), but EViews keeps producing the same forecasts as in the baseline scenario, meaning that it's still uses the baseline scenario (although it does the override).

Just if you need to know the model structure, it's basically like this:
m_country.scenario(n, a=e2) esc2
rename {%V}_esc2 {%V}_esc1_e2 [where {%V} is the set of exogenous variables]
next
m_country.override(m) pib_r_eeuu_esc1
m_country.solve

What could I be missing or should check once again?

Thanks for your time and generosity!

Ricardo

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

Re: Substituting observations for indpt. var. after estimation

Postby EViews Gareth » Fri Mar 25, 2022 9:48 am

I don't see anything wrong. A simple example:

Code: Select all

wfcreate m 2000 2020

series pib_r_eeuu_esc1 = 3
series pib_r_eeuu_esc1_e2 = 5


model m_country
m_country.add y = pib_r_eeuu_esc1
m_country.scenario(n, a=e2) esc2
m_country.override(m) pib_r_eeuu_esc1
m_country.solve

show y_e2
Follow us on Twitter @IHSEViews

rbebczuk
Posts: 4
Joined: Wed Jan 12, 2022 8:10 am

Re: Substituting observations for indpt. var. after estimation

Postby rbebczuk » Sat Apr 16, 2022 5:11 pm

Hi Gareth, thanks a lot for your kind response, and sorry for the late reply. As you say, the code was right, but there was a problem in some other part of the program, which I was able to fix after some digging. Thanks again!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 23 guests