How to perform regression with random walk coefficients

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

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

How to perform regression with random walk coefficients

Postby stasibab » Thu May 12, 2011 6:34 am

Hello,

I am trying to find if kalman filter can be used for calculating parameters for combined forecasts.

For example if we have f1,f2 forecasts based on Granger and Ramanathan (1984)
we can calculate a forecast combination of the form of a regression. fc= a0 + a1*f1 + a2*f2+ u. So we are trying to find the parameters of a regression like Y=A0+A1*f1+A2*f2.

Based on Kalman theory I want to calculate the time-varying coefficients with random walk procedure: A(t+1)=A(t) + n(t)

How can I do this through eviews? I know that eviews has kalman filtering but I cannot understand how to apply my data on the following equations, which will be eur/usd returns.

Let's say that we have the Yt= btXt+et
bt=bt-1+nt

1)the H,Q matrixes how are they initialized?
2) What are the Ft,Pt,Vt matrixes?

Thank you in advance!

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: How to perform regression with random walk coefficients

Postby EViews Glenn » Thu May 12, 2011 12:34 pm

Have you looked at the EViews chapter on state space models? There's a discussion of exactly the random walk model that you propose, along with a description of how to use the auto-specify tools to build your state space specification.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Thu May 12, 2011 2:49 pm

Yes I looked up but I am still confused.

Any ideas what I could look for more??

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Thu May 12, 2011 2:50 pm

Have you looked at the EViews chapter on state space models? There's a discussion of exactly the random walk model that you propose, along with a description of how to use the auto-specify tools to build your state space specification.
Where do you mean?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: How to perform regression with random walk coefficients

Postby EViews Glenn » Thu May 12, 2011 4:15 pm

User's Guide II, Chapter 33, State Space Models and the Kalman Filter
esp. p. 500-501.

I looks to me as though you could use the auto-specification tools, entering Y as your dependent variable, C as a recusrive coefficient, and F1 and F2 as variables with random walk coefficients in the stochastic regressors tab.

The example of Recursive and Random coefficients on p. 496 has an example with both a random walk and a pure recursive coefficient.

terrya
Posts: 107
Joined: Wed Aug 26, 2009 2:37 pm

Re: How to perform regression with random walk coefficients

Postby terrya » Thu May 12, 2011 4:38 pm

Hi
Can you explain how I can use autospec to get this model? I've tried various way and can't reproduce it. I didn't find the guide much help with this.

Code: Select all

@SIGNAL LGAP = SV1 + [VAR=EXP(C(1))] @STATE SV1 = SV1(-1) + SV2(-1) @STATE SV2 = SV2(-1) + [VAR=EXP(C(3))]

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: How to perform regression with random walk coefficients

Postby trubador » Fri May 13, 2011 12:29 am

This tool is useful only if your model is a standard regression. Your specification, however, is an example of stochastic smooth trend model.

terrya
Posts: 107
Joined: Wed Aug 26, 2009 2:37 pm

Re: How to perform regression with random walk coefficients

Postby terrya » Fri May 13, 2011 2:08 am

This tool is useful only if your model is a standard regression. Your specification, however, is an example of stochastic smooth trend model.
Yeah, I knew that. I wanted to reproduce in EViews the results that I got in RATS and STAMP. But I was trying to see if the autospec could reproduce it. I assume that it can't from your comment (and Gareth's about the need to edit the spec).

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Fri May 13, 2011 5:23 am

User's Guide II, Chapter 33, State Space Models and the Kalman Filter
esp. p. 500-501.

I looks to me as though you could use the auto-specification tools, entering Y as your dependent variable, C as a recusrive coefficient, and F1 and F2 as variables with random walk coefficients in the stochastic regressors tab.

The example of Recursive and Random coefficients on p. 496 has an example with both a random walk and a pure recursive coefficient.

thank you for the guide now I am having some progress.
now I am having some problems to auto specify the data of the following file.

the regression has to be of the form
lrcons = sv(0) + sv1*lrgdp + sv2*lrprice + resid(????)

the betas of my regression I want to be recursive lige bt=bt-1 + et

1) I go to the autospecification tool and I put in the dependant variables: lrcons
2) regressors with fixed coefficients I assume I leave it blank
3) regressos with recursice coefficients: lrgpd lrprice
4) AR and MA (?????)

Coefficient base name c

In the next tab I assume I have to leave all blanks except the space that says random walk coefficients : should i write c(1)= c(-1) + resid (???)

Thanx a lot in advance!!
Attachments
kalman housing eviews.WF1
(12.01 KiB) Downloaded 547 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: How to perform regression with random walk coefficients

Postby EViews Glenn » Fri May 13, 2011 10:39 am

I'm confused, do you want a random walk coefficient model or something more complicated like the trend model you posted earlier? If the former (answering the last response).


Basic Regression Tab
------------------------
Dependent variable: LRCONS
No fixed
No recursive

Stochastic Regressors Tab
------------------------------
Random walk coefficients: C LRGDP LRPRICE

Note that this assumes you want the SV1, SV2, SV3 to evolve as
SV1(t) = SV1(t-1) + E1_t

etc.

Variance Specification Tab
------------------------------
Diagonal is fine for the signal variance and the state variance (assuming you don't want to restrict the variances in the state equations).


---

But from your response to trubador, this may not be what you want!! As trubador noted, the auto-spec is only an aid to help people set up the simplest types of specifications.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Fri May 13, 2011 11:54 am

Thanks for the reply,

U are confused i think! Trubadors reply was, i think for another person.

The way you said it worked for me perfectly. I think this is a random walk. But many that implement Kalman Filtering (as I found in many papers) they use random walk procedure as a simple Kalman filter! Am i right? Should Kalman filter use recursive coefficients?

In any way I am interested in recursive ways to do the same.

Then do I have to put : c lrgdp lrprice into the 'recursive coefficients' area and leave the stohastic regressors blank? Probably not right?

Thank you in advance

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Fri May 13, 2011 12:03 pm

User's Guide II, Chapter 33, State Space Models and the Kalman Filter
esp. p. 500-501.

I looks to me as though you could use the auto-specification tools, entering Y as your dependent variable, C as a recusrive coefficient, and F1 and F2 as variables with random walk coefficients in the stochastic regressors tab.

The example of Recursive and Random coefficients on p. 496 has an example with both a random walk and a pure recursive coefficient.

For example I run it like you said earlier

Dependant lrcons
Recursive coefficient c

stohastic tab

lrgdo lrprice


And my estimation worked, but i am not really sure about the difference between them??!!
What is closer to a Kalman Filter?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: How to perform regression with random walk coefficients

Postby EViews Glenn » Fri May 13, 2011 3:47 pm

Ah, two people posting in the same thread...nice...

When you put variables in the recursive their coefficients are states that don't have an error term. If all of your variables are here, you are doing the equivalent of recursive least squares where the filtered states are the least squares coefficient estimates using information through the period in question.

When you put variables in the stochastic, their coefficients are states that do have an error term. For the latter, you then have a question of how the state evolves. You appear to want them to evolve as random walks, but ARs and RWs with trends are also possible from the auto-spec.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Fri May 13, 2011 4:16 pm

Thank you for the response!

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: How to perform regression with random walk coefficients

Postby stasibab » Tue May 17, 2011 5:53 pm

Using the file that i said earlier, the random walk process with the state auto-specification process works fine, but it does not give me a forecast? Any ideas why?


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests