Page 1 of 2
Excel Example of an AR(1) Model from Eviews
Posted: Tue Dec 16, 2008 2:54 pm
by medlo
Basic ? Anyone have an example of an excel implementation of EViews output of an AR(1) model that they can post? Thanks
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Dec 16, 2008 3:21 pm
by EViews Gareth
I'm not sure I follow what you're asking. Are you asking if someone has an Excel example of the estimation of an AR(1) model? Or are you asking if someone has put EViews output into Excel (which seems like a trivial question)?
Re: Excel Example of an AR(1) Model from Eviews
Posted: Wed Dec 17, 2008 12:56 pm
by medlo
yes an Excel example of an AR(1) thx
Re: Excel Example of an AR(1) Model from Eviews
Posted: Wed Dec 17, 2008 12:57 pm
by EViews Gareth
Again, are you asking of an example of Excel calculating an AR(1)?
Re: Excel Example of an AR(1) Model from Eviews
Posted: Wed Dec 17, 2008 5:18 pm
by shhgc2
I am not sure that I catched what you means. but you can use below inputcode and translate to excel.
Excel has a random generator.
Code: Select all
wfcreate AR a 1950 2000
'creating indepedent variable
series x=7*@sin(@trend+1)
'creating error term with N(0,1)
series u=nrnd
series e=u
'creating error term with ar(1) and rho is 0.85
'error term(u) =0.85*u(-1)+e
'creating dependent variable
series y=x+(0.85*u(-1)+e)
equation out1.ls y x
show out1
equation out2.ls y x ar(1)
show out2
Re: Excel Example of an AR(1) Model from Eviews
Posted: Thu Dec 18, 2008 2:59 am
by trubador
As I understand, you are willing to build an AR(1) model in Excel and to compare the estimation results with those of EViews'. I believe you are trying to understand the underlying mechanism of AR estimations. Such exercises (both specification and estimation) are very difficult to be carried out in Excel, since it is a data-centric program. In other words, EViews assigns your time series data into a single variable, whereas Excel stores in cells.
There is a small difference in the code written by shhgc2. If you generate the series y = x + (0.85*u(-1)+e)) and estimate is as equation out2.ls y x ar(1) the results will be different than you expect, since the latter means you actually estimate y = c(1)*x + [ar(1) = c(2)]. Other than that, it is very useful and in the file attached you will find the Excel version this code. The only difference is that I preferred to include the c(1) coefficient and assigned 0.5 as its simulated value.
Please note that, estimation of the model in Excel requires Solver add-in. In worksheet, you will also find the output from EViews for comparison purposes.
Re: Excel Example of an AR(1) Model from Eviews
Posted: Thu Dec 18, 2008 2:17 pm
by shhgc2
That's good excel example. and a good explanation from trubador.
I just add some comments. in equation y = x + (0.85*u(-1)+e)), y = c(1)*x + [ar(1) = c(2)], My code is that c(1)=1 for simplifying the coefficient.
so, if you do simulation, you can easily find the c(1)=1. I also attached simulation code.
Code: Select all
wfcreate AR a 1950 2000
series x=7*@sin(@trend+1)
for !j= 1 to 1000
series u{!j}=nrnd
series e{!j}=u{!j}
series y{!j}=1*x+(0.85*u{!j}(-1)+e{!j})
equation out2{!j}.ls y{!j} x ar(1)
series beta1(!j)=out2{!j}.@coef(1)
next
show beta1.stats
Re: Excel Example of an AR(1) Model from Eviews
Posted: Fri Dec 19, 2008 3:43 pm
by medlo
Many hanks for the insightful comments and for taking the time to respond. Happy Holidays all.
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Feb 17, 2009 5:16 pm
by colden
I am trying to recreate predicted values from an AR(1) model outputted by EViews using Excel. I found the Excel example posted here very helpful but I was wondering if someone could expand it to show how exactly EViews calculates its predicted values using the "Static Forecast" option. Specifically, I cannot arrive at EViews' predicted values using Excel and I believe it is because I am not understanding how the AR(1) term enters into the equation. Could someone please explain exactly how EViews arrives at its predicted values using actual numbers from the Excel example posted earlier in this thread? Thanks,
Chris Oldenburg
chris_oldenburg@hotmail.com
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Feb 17, 2009 5:39 pm
by EViews Gareth
At some point over the next few days I might write up a more general explanation of how AR estimation/forecasting in EViews works, but for now, here's a program I have lying on my hard disk that should explain forecasting a simple ar:
Code: Select all
rndseed 1
create u 100
series x=nrnd
series y=nrnd
equation e1.ls y c x ar(1)
'Static Forecast
series restemp=y-c(1)-c(2)*x
smpl 20 100
e1.fit yhats1 'EViews fitted values (static)
series yhats2=c(1)+c(2)*x+c(3)*restemp(-1) 'completely manual calculation
'Dynamic Forecast
e1.forecast yhatd1 'EViews fitted values (dynamic)
smpl 20 20
series yhatd2=c(1)+c(2)*x+c(3)*restemp(-1) 'manual calculation of first value
smpl 21 100
series yhatd2 = c(1)+c(2)*x+c(3)*(yhatd2(-1)-c(1)-c(2)*x(-1)) 'manual calculation of other values.
smpl 20 100
show yhatd1 yhatd2
Re: Excel Example of an AR(1) Model from Eviews
Posted: Wed Feb 18, 2009 11:18 am
by colden
Thank you for your program. I have used the data from the previous Excel example, estimated and forecasted using EViews, and then compared EViews' predicted values to those resulting from your calculation method. The two are slightly different, and the differences are too large to be due to rounding I think. Please see attached. Thanks,
Chris
Re: Excel Example of an AR(1) Model from Eviews
Posted: Wed Feb 18, 2009 12:59 pm
by EViews Gareth
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Aug 18, 2015 8:57 am
by ar2
Hi folks,
The excel example for ar(1) forecast is truly helpful. It enabled us to build a tool to forecast the outcome based on various scenarios for the independent variables. I tried to expand the excel example to ar(2) cases without any success. Is there a similar excel example available when the equation includes ar(2)?
Thanks!
-John
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Aug 18, 2015 9:02 am
by EViews Gareth
No, but it is a trivial extension.
Re: Excel Example of an AR(1) Model from Eviews
Posted: Tue Aug 18, 2015 9:13 am
by ar2
Can you possibly help build an example, Gareth? I have been using models without ar(2) due to implementation hurdle.
Actually the particular model has both ar(1) and ar(2) in the equation...
Thanks!