Stability tests with kalman filter

Discussion of State Space and Dynamic Stochastic General Equilibrium Models

Stability tests with kalman filter

Postby Aktar » Thu Aug 13, 2009 5:23 pm

Hi

i have make my kalman filter estimate with eviews, and i want make cusum and chow test. How i can perfom these without make estimate with rats ?

And if i want make test over residuals which programms i must take ?

thank you
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby TomDoan » Thu Aug 13, 2009 9:18 pm

Once you have the recursive residuals, you can do the CUSUM and Chow tests using anything that can do squares and sums. If you don't have the recursive residuals, you can't get them without redoing the model in RATS. So I'm rather puzzled about why you want to do this by moving the easy part to a different program.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Stability tests with kalman filter

Postby Aktar » Tue Aug 18, 2009 11:57 am

I don't know if i can have recursive residuals but i think have find

im not sure between all these choice :

smoothed state disturbance estimates
the standardized smoothed state disturbances


i have ask in the forums of eviews but don't have a response


and after which programms i must run ?

thank you very much
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby TomDoan » Tue Aug 18, 2009 12:12 pm

The recursive residuals are the "one-step ahead standardized residuals."
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Stability tests with kalman filter

Postby Aktar » Tue Aug 18, 2009 12:54 pm

ok thanks so it is std. residual of signal series ?

after i take the prog constant.prg ?

thank you very much
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby TomDoan » Wed Aug 19, 2009 7:43 am

You can't use CONSTANT.PRG directly, since it uses RLS, which generates some additional statistics (like the CUSUM). You also can't use the "STABTEST" procedure, since that is specific to an OLS regression.

If you're just starting with the recursive residuals (recresids below, defined over rstart to rend), the CUSUM test would be:

Code: Select all
compute %ndf=(rend-rstart+1)
acc recresids rstart rend cusum
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUM test") 3
# cusum
# lower5 / 2
# upper5 / 2


You can generate the CUSUMSQ with this:

Code: Select all
set recresidsqr = recresids^2
acc recresidsqr rstart rend cusumsq


That can be used to form various stability tests like Chow-predictive tests. For instance, a test for the last eight periods can be done with

Code: Select all
compute f=((cusumsq(rend)-cusumsq(rend-8))/8)/(cusumsq(rend-8)/(%ndf-8))
cdf(title="Post-Sample Predictive Test") ftest f 8 %ndf-8
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Stability tests with kalman filter

Postby Aktar » Wed Aug 19, 2009 8:29 am

thank you very much you are magic !

but i don't know how i must set rend and rstart. I have this


Code: Select all
calendar 2002 1 1
allocate 85
open data Classeur1.xls
data(for=xls, org=obs) / recresids
table

set rend =
set rsart =

compute %ndf=(rend-rstart+1)
acc recresids rstart rend cusum
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUM test") 3
# cusum
# lower5 / 2
# upper5 / 2


thank you
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby TomDoan » Wed Aug 19, 2009 9:20 am

Assuming the residuals start right at the beginning of the file, rstart=1, rend=85
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Stability tests with kalman filter

Postby moderator » Wed Aug 19, 2009 9:25 am

RSTART and REND would need to be integers, not series, so you would use COMPUTE rather than SET to set them.

You want to set them equal to the desired starting and ending entry numbers or dates, as Tom Doan noted.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Stability tests with kalman filter

Postby Aktar » Wed Aug 19, 2009 5:42 pm

than you very much it run !

a last question ;

Code: Select all
calendar 2000 1 12
allocate 108
open data Classeur1.xls
data(for=xls, org=obs) / recresids
table

compute rstart=2000:1
compute rend=2008:12
compute %ndf=(rend-rstart+1)
acc recresids rstart rend cusum
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUM test") 3
# cusum
# lower5 / 2
# upper5 / 2


**cusum square
set recresidsqr = recresids^2
acc recresidsqr rstart rend cusumsq
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUMQ test") 3
# cusum
# lower5 / 2
# upper5 / 2


I have the same thing when i compute cusum square test, it is something wrong in my prog ?
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby moderator » Thu Aug 20, 2009 9:09 am

Aktar wrote:I have the same thing when i compute cusum square test


The same thing as what? Please clarify.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Stability tests with kalman filter

Postby Aktar » Thu Aug 20, 2009 2:44 pm

sorry, i have the same graphic "cusum" when i compute the prog for cusum square and cusum


For cusum
Code: Select all
calendar 2000 1 12
allocate 108
open data Classeur1.xls
data(for=xls, org=obs) / recresids
table

compute rstart=2000:1
compute rend=2008:12
compute %ndf=(rend-rstart+1)
acc recresids rstart rend cusum
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUM test") 3
# cusum
# lower5 / 2
# upper5 / 2


and for cusum square :

Code: Select all
calendar 2000 1 12
allocate 108
open data Classeur1.xls
data(for=xls, org=obs) / recresids
table

**cusum square

compute rstart=2002:2
compute rend=2008:12
compute %ndf=(rend-rstart+1)

set recresidsqr = recresids^2
acc recresidsqr rstart rend cusumsq
set upper5 rstart rend = .948*sqrt(%ndf)*(1+2.0*(t-rstart+1)/%ndf)
set lower5 rstart rend = -upper5
graph(header="CUSUMQ test") 3
# cusum
# lower5 / 2
# upper5 / 2
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby moderator » Thu Aug 20, 2009 3:18 pm

Aktar wrote:sorry, i have the same graphic "cusum" when i compute the prog for cusum square and cusum

...

Code: Select all
graph(header="CUSUMQ test") 3
# cusum
# lower5 / 2
# upper5 / 2


It appears from the GRAPH instruction above that you are graphing the series CUSUM, when you meant to graph the series CUSUMSQ.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Stability tests with kalman filter

Postby Aktar » Fri Aug 21, 2009 10:49 am

ok thanks but it normal that the corridor is the same for the 2 tests ?
Aktar
 
Posts: 35
Joined: Thu Apr 16, 2009 8:12 am

Re: Stability tests with kalman filter

Postby TomDoan » Fri Aug 21, 2009 11:08 am

Aktar wrote:ok thanks but it normal that the corridor is the same for the 2 tests ?


No, they're quite different (rather obviously, since the sums of squares can't be negative). The CUSUMQ is based upon the maximum gap between a straight line and the cumulated sum of squares, standardized to end at 1.0:

Code: Select all
set recresidsqr = recresids^2
acc(standardize) recresidsqr rstart rend cusumsq
set target rstart rend = (t-rstart+1.0)/(rend-rstart+1.0)
graph 2
# cusumsq
# target


If the squared residuals are roughly the same size throughout the data, that will tend to hug the line. If they're generally small, then get larger, it will drop well below the line early in the data set.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Next

Return to State Space Models/DSGE

Who is online

Users browsing this forum: No registered users and 1 guest

cron