Estimating a AR(1) process

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Estimating a AR(1) process

Postby xihapipi » Wed Aug 04, 2010 12:12 pm

Hi,
I'm trying to estimate parameters of a mean-reverting stochastic process, which can be written in the equation as attached in the word document.
I'm very inexperienced with eviews and I'm having problem running the estimation using the maximum likelihood estimation.
I have tried to follow the manual and written the log likelihood specification also shown in the word document attached, but returned syntax error...

Can anyone what I'm doing wrong here please? And how can I do this estimation in eviews?

Any suggestion will be greatlly appreciated. Thanks
Attachments
I.doc
(75.5 KiB) Downloaded 386 times

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

Re: Estimating a AR(1) process

Postby EViews Gareth » Wed Aug 04, 2010 1:12 pm

Posting your workfile is probably helpful.

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

Re: Estimating a AR(1) process

Postby startz » Wed Aug 04, 2010 1:29 pm

You might begin by just estimating this as a nonlinear regression. The only thing you wouldn't get is the standard errors for sigma^2.

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Re: Estimating a AR(1) process

Postby xihapipi » Wed Aug 04, 2010 1:40 pm

I have attached my workfile.
Basically the time series y, is the log of oil prices (weekly) data over a period, which I assume that it follows the process

dY(t)=a(b-Y(t))dt+vdWt, which is a Ornstein-Uhlenbek stochastic process.
(sorry i can't type lamda here, so the "a" in this equation is the lamda in the word doc, and the "b" in this equation is the x-bar in the word doc, and v here is the sigma in the word doc)

And in discrete time, I should be able to estimate the parameters of the process by looking at the AR(1) process as in the word document.

Sorry my questions may seem quite stupid, as I have really limited knowledge of Eviews, but I am in desperate need to figure out how to do this...

Many thanks
Attachments
oilprice9095.WF1
(19.28 KiB) Downloaded 262 times

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Re: Estimating a AR(1) process

Postby xihapipi » Wed Aug 04, 2010 1:44 pm

You might begin by just estimating this as a nonlinear regression. The only thing you wouldn't get is the standard errors for sigma^2.
Could you elaborate a bit more please? Do I just regress it using "Equation", and enter my regression equation, or is there a functionaliy for non-linear regressio in eviews?

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

Re: Estimating a AR(1) process

Postby EViews Gareth » Wed Aug 04, 2010 1:52 pm

You were missing a multiplication sign in your definition of RES. Also, you probably want to time shift things a bit. I think a working definition of RES would be something like:

Code: Select all

res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
(note you'll need to set the C vector equal to 1 before hand to get this to estimate)

However, as Startz points out, you're probably better of doing it in an equation, with a specification of:

Code: Select all

Y=C(1)*(1-EXP(-C(2)*0.02))-EXP(-C(2)*0.02)*Y(-1)

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Re: Estimating a AR(1) process

Postby xihapipi » Wed Aug 04, 2010 2:06 pm

You were missing a multiplication sign in your definition of RES. Also, you probably want to time shift things a bit. I think a working definition of RES would be something like:

Code: Select all

res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
(note you'll need to set the C vector equal to 1 before hand to get this to estimate)

However, as Startz points out, you're probably better of doing it in an equation, with a specification of:

Code: Select all

Y=C(1)*(1-EXP(-C(2)*0.02))-EXP(-C(2)*0.02)*Y(-1)

Thank you for your answer. But I don't understand what you meant by "setting the vector C equal to 1"... sorry, could you explain to me what this is and how I can do this please? thank you so much.

I don't fully know what's the problem here but I don't think the equation Y=C(1)*(1-EXP(-C(2)*0.02))-EXP(-C(2)*0.02)*Y(-1) works - as I think the residual term depends on c(2), and it generates a very weird result (a very large number for c(2), lamda) when i ran it... What i did was that I ran the above regression with LS criteria using the object/equation. Is there something that I'm doing wrong here?


I apologise for the length of my questions and my limited knowledge...

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

Re: Estimating a AR(1) process

Postby EViews Gareth » Wed Aug 04, 2010 2:09 pm

Code: Select all

c=1
In the command window.
You'll also need to estimate from the second period onwards

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Re: Estimating a AR(1) process

Postby xihapipi » Wed Aug 04, 2010 2:15 pm

@logl logl1

res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
var=c(3)*0.14
c=1
logl1=log(@dnorm(res/@sqrt(var)))-log(var)/2

you mean like this?

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

Re: Estimating a AR(1) process

Postby startz » Wed Aug 04, 2010 5:24 pm

You were missing a multiplication sign in your definition of RES. Also, you probably want to time shift things a bit. I think a working definition of RES would be something like:

Code: Select all

res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
(note you'll need to set the C vector equal to 1 before hand to get this to estimate)

However, as Startz points out, you're probably better of doing it in an equation, with a specification of:

Code: Select all

Y=C(1)*(1-EXP(-C(2)*0.02))-EXP(-C(2)*0.02)*Y(-1)
snip
I don't fully know what's the problem here but I don't think the equation Y=C(1)*(1-EXP(-C(2)*0.02))-EXP(-C(2)*0.02)*Y(-1) works - as I think the residual term depends on c(2), and it generates a very weird result (a very large number for c(2), lamda) when i ran it... What i did was that I ran the above regression with LS criteria using the object/equation. Is there something that I'm doing wrong here?


I apologise for the length of my questions and my limited knowledge...
The residual doesn't depend on c(2), although you would need c(2) to back out the sigma^2 parameter.
You might start out with

Code: Select all

ls y c y(-1)
and then back out lambda and sigma^2 by hand. That's the maximum likelihood estimator.

xihapipi
Posts: 6
Joined: Wed Aug 04, 2010 11:41 am

Re: Estimating a AR(1) process

Postby xihapipi » Thu Aug 05, 2010 11:29 am

I think I'm getting what I want now. Thank you so much!


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests