VAR with time-varying parameters and stochastic volatility

Questions and discussions on Vector Autoregressions
tavera
Posts: 15
Joined: Thu Dec 10, 2009 9:50 am

VAR with time-varying parameters and stochastic volatility

Unread post by tavera »

Recently, someone posted a Rats program which permits to replicate the basic results of Giorgio Primiceri, (2005), "Time Varying Structural Vector Autoregressions and Monetary Policy," Review of Economic Studies, 72, 821-852.
I have tried to use this program to analyse the transmission mechanims among monthly prices for three agricultural products (wheat, corn and soybean). However, the program beaks down systematically with these data series and I get the following message :
## EQ4. Equation %MODELEQN(VARMOD Has At Least One Undefined or NA Coefficient
The Error Occurred At Location 612, Line 27 of loop/block
How can I find where the error is ?
Copies of the program , the data base and the procedure are attached to this mail.

Thanks in adavance
Attachments
sent to estima.rar
(21.74 KiB) Downloaded 865 times
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: VAR with time-varying parameters and stochastic volatili

Unread post by moderator »

Generally speaking, you can use Edit-Show Last Error to jump to the instruction that caused an error. To make use of the "instruction location" information more generally, you can execute the entire program in "batch" fashion by doing:

SOURCE(ECHO) programfile

in the input window, rather than opening the file and executing it. You will see that lines in any compiled sections (loops, procedures, and so on) will be prefixed with instruction locations, which also indicate levels of nesting.

To understand how to use this location information, see "Instruction Locations-Debugging Compiled COde" on page 460 of the RATS 8 User's Guide, or "Instruction Locations" in Section 16.1 of the RATS 7 (and earlier) User's Guide.

Regards,
Tom Maycock
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VAR with time-varying parameters and stochastic volatili

Unread post by TomDoan »

tavera wrote:Recently, someone posted a Rats program which permits to replicate the basic results of Giorgio Primiceri, (2005), "Time Varying Structural Vector Autoregressions and Monetary Policy," Review of Economic Studies, 72, 821-852.
I have tried to use this program to analyse the transmission mechanims among monthly prices for three agricultural products (wheat, corn and soybean). However, the program beaks down systematically with these data series and I get the following message :
## EQ4. Equation %MODELEQN(VARMOD Has At Least One Undefined or NA Coefficient
The Error Occurred At Location 612, Line 27 of loop/block
How can I find where the error is ?
Copies of the program , the data base and the procedure are attached to this mail.

Thanks in adavance
You need to clean up your set up code, as you have quite a bit of date information that was copied from the original program that doesn't match yours. For instance, in the following, you're setting endsmpl based upon the 1981:4 start point (which is the CALENDAR at work at that point) rather than the 1976:1 that you actually want.

Code: Select all

comp styr = 1981
cal(m) styr:4
comp stsmpl = styr:4
comp endsmpl = 2011:1  ;* "endsmpl" is the last observation period.
That all should go.

Also, there are some settings for IMPDATES (the dates at which the impulse responses are computed) later in the program file that should be brought up into the set up code, and replaced with values that are appropriate for your data set. (I've done that here, but you'll also have to delete the old ones in the program file).

Code: Select all

********************************
******************************** reading in Koop's data
********************************
OPEN DATA montlypricecornwheatsojadeb81.RAT
CALENDAR(M) 1976
ALL 2021:12
DATA(FORMAT=RATS) 1976:01 2011:01 SOYBEAN CORN WHEAT PETROL
comp endsmpl = 2011:1  ;* "endsmpl" is the last observation period.
close
comp nstep = 16        ;* number of impulse response steps

comp [vec[int]] impdates = ||1990:1,2000:1,2010:1||


*dofor i = pigdp
* set(scratch) i stsmpl+1 endsmpl = 400.*log(i{0}/i{1})
*end do i

** for storing variable names, allocate label vector and order position of real variable
dec vec[string] varlabels(nvar)

dec vec[ser] y(nvar)

comp k = 0
dofor i = wheat corn soybean
 comp k = k+1
 set y(k) = i{0}
 comp varlabels(k) = %l(i)
end do i

********************************
******************************** setting data sample, and weighting energy inflation
********************************

comp prenobs = 60
comp stpt = 1987:1
comp endpt = endsmpl
touremam
Posts: 1
Joined: Wed Jan 25, 2012 12:25 pm

Re: VAR with time-varying parameters and stochastic volatili

Unread post by touremam »

I'm trying to replicate the Primiceri Rats codes for estimating monetary mechanism transmission. The program runs correctly when i use three (3) endogenous variables in the VAR model. However, it systematically breaks down for more than three (3) variables.
The error message is as follow :
The Error Occurred At Location 8135, Line 504 of VARTVPKSC
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC.

How can I solve it?

Thanks you for your help.
Post Reply