Hi there,
First of all, thank you again to jpfeifer and StephaneAdjemian for their help on previous questions I've had. As it stands, I've almost completed what I set out to do, but there are a few things that are still stopping me from getting the results I want.
The first problem is the presence of a trend that shouldn't exist. The GDP gaps I'm trying to calculate are measured as the percentage deviation of actual output from flexible-price equlibirium output. As such, the series should generally be centered around 0, with no growth trend, and should be positive during booms and negative during recessions. Here is a graph of the original authors' results:
My graph, however, has a clear upward trend:
Note that the model should be stationary in technology (technology is controlled by a simple AR(1) process), and endogenous variables are percent deviations from steady-state values.
The second problem is that the parameter values aren't in line with what the original authors produced, despite being derived from (essentially) the same data. Here, it seems as though the Markov chain isn't exploring the entire state space, since some of the prior means and posterior means (especially for the shocks) are essentially identical. This is a big difference from the original paper. For comparison, here is a list of prior and posterior means both from the original paper:
as well as my own attempt (priors are the same):
tau 1.3752
h 0.9728
omega 0.8949
r_star 3.2630
eta 0.6969
phi_pi 1.5401
phi_y 0.5035
rho_r 0.8554
rho_d 0.3230
rho_z 0.8304
rho_a 0.5368
gamma_star 0.4707
pi_star 1.5905
sigma_r 0.4928
sigma_d 0.5024
sigma_z 0.4966
sigma_a 0.4976
I've tried checking and re-entering the equations a bunch of times, increasing the number of iterations, as well as re-examining the data, but everything seems to check out. I've attached links to the original paper, my code, and my data. If anyone out there could spare a minute to check it out I would really appreciate it.