Estimating a AR(1) process
Moderators: EViews Gareth, EViews Moderator
Estimating a AR(1) process
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
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
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
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.
Re: Estimating a AR(1) process
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
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
Re: Estimating a AR(1) process
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?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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimating a AR(1) process
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:
(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
res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
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)
Re: Estimating a AR(1) process
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:(note you'll need to set the C vector equal to 1 before hand to get this to estimate)Code: Select all
res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
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
Code: Select all
c=1You'll also need to estimate from the second period onwards
Re: Estimating a AR(1) process
@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?
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
The residual doesn't depend on c(2), although you would need c(2) to back out the sigma^2 parameter.snipYou 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:(note you'll need to set the C vector equal to 1 before hand to get this to estimate)Code: Select all
res=y-c(1)*(1-exp(-c(2)*0.02))-exp(-c(2)*0.02)*y(-1)
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)
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...
You might start out with
Code: Select all
ls y c y(-1)Re: Estimating a AR(1) process
I think I'm getting what I want now. Thank you so much!
Who is online
Users browsing this forum: No registered users and 2 guests
