Excel Example of an AR(1) Model from Eviews
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Excel Example of an AR(1) Model from Eviews
Basic ? Anyone have an example of an excel implementation of EViews output of an AR(1) model that they can post? Thanks
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Excel Example of an AR(1) Model from Eviews
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)?
Follow us on Twitter @IHSEViews
Re: Excel Example of an AR(1) Model from Eviews
yes an Excel example of an AR(1) thx
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Excel Example of an AR(1) Model from Eviews
Again, are you asking of an example of Excel calculating an AR(1)?
Follow us on Twitter @IHSEViews
Re: Excel Example of an AR(1) Model from Eviews
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.
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
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.
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.
Last edited by trubador on Thu Dec 18, 2008 11:58 pm, edited 2 times in total.
Re: Excel Example of an AR(1) Model from Eviews
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.
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
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
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
Chris Oldenburg
chris_oldenburg@hotmail.com
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Excel Example of an AR(1) Model from Eviews
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
Follow us on Twitter @IHSEViews
Re: Excel Example of an AR(1) Model from Eviews
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
Chris
- Attachments
-
- eViews Example.xls
- (21 KiB) Downloaded 1575 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Excel Example of an AR(1) Model from Eviews
Follow us on Twitter @IHSEViews
Re: Excel Example of an AR(1) Model from Eviews
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Excel Example of an AR(1) Model from Eviews
No, but it is a trivial extension.
Follow us on Twitter @IHSEViews
Re: Excel Example of an AR(1) Model from Eviews
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!
Actually the particular model has both ar(1) and ar(2) in the equation...
Thanks!
Last edited by ar2 on Tue Aug 18, 2015 9:33 am, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 48 guests