Matheson-Stavrev EL 2013
Matheson-Stavrev EL 2013
Dear Mr. Doan,
Through rats coding I want to emulate the Kalman Filter estimation of the article as below.
Matheson, Troy, and Emil Stavrev. "The Great Recession and the inflation puzzle." Economics Letters 120.3 (2013): 468-472.
This paper was also published as IMF working paper on May 2013 - to save your searching time I sent this paper to your another e-mail account , rats-l@list.mafc.mq.edu.au.
I am trying to do this job consulting one of your textbooks, "Rats Hankbook for State Space Models (draft version, Jan. 2010)."
I would really appreciate if you should inform me "concretly" the relevant parts or relevant code examples of the book.
Through rats coding I want to emulate the Kalman Filter estimation of the article as below.
Matheson, Troy, and Emil Stavrev. "The Great Recession and the inflation puzzle." Economics Letters 120.3 (2013): 468-472.
This paper was also published as IMF working paper on May 2013 - to save your searching time I sent this paper to your another e-mail account , rats-l@list.mafc.mq.edu.au.
I am trying to do this job consulting one of your textbooks, "Rats Hankbook for State Space Models (draft version, Jan. 2010)."
I would really appreciate if you should inform me "concretly" the relevant parts or relevant code examples of the book.
Re: Relevant Kalman Filter Codes for the Paper
It appears that Matheson and Stavrev had a flaw in their handling of the constraints, see https://estima.com/forum/viewtopic.php?p=12911#p12911.
Re: Matheson-Stavrev EL 2013
There's a more complete example now provided at https://estima.com/forum/viewtopic.php? ... 986#p14850
This has the estimation of the EKF without the constraints on the time-varying coefficients (on a reproduction data set---I couldn't make any sense out of the data they provided). As indicated in the link to the other thread, what they did to handle the (inequality) constraints isn't technically correct---the inequality-constrained estimates of the states do get generated by equality-constrained optimization, but the hard part is figuring out which points actually need to be constrained. This also does not put the constraints on the variance parameters from rolling regressions. Note that pretty much all of these NAIRU-Phillips Curve models only give "reasonable" results with a lot of careful constraints on almost anything free in the model---the decomposition of U into NAIRU+Gap really can't be done without fairly tight constraints on the variance ratio, and the Phillips curve doesn't really vary enough with the gap to provide an extra piece of information to separate the two components.
This uses a new feature with 9.2 for pulling off and renaming FRED data. If you don't have 9.2, just use the original names and do SET instruction to copy to series with shorter names.
This has the estimation of the EKF without the constraints on the time-varying coefficients (on a reproduction data set---I couldn't make any sense out of the data they provided). As indicated in the link to the other thread, what they did to handle the (inequality) constraints isn't technically correct---the inequality-constrained estimates of the states do get generated by equality-constrained optimization, but the hard part is figuring out which points actually need to be constrained. This also does not put the constraints on the variance parameters from rolling regressions. Note that pretty much all of these NAIRU-Phillips Curve models only give "reasonable" results with a lot of careful constraints on almost anything free in the model---the decomposition of U into NAIRU+Gap really can't be done without fairly tight constraints on the variance ratio, and the Phillips curve doesn't really vary enough with the gap to provide an extra piece of information to separate the two components.
This uses a new feature with 9.2 for pulling off and renaming FRED data. If you don't have 9.2, just use the original names and do SET instruction to copy to series with shorter names.
Re: Matheson-Stavrev EL 2013
I really appreciate your help. I will check this out right now.
By the way if Matheson-Stavrev's Kalman Filter code has critical errors or faults, it might mean disaster - as far as I know many economists' papers such as Oliver Blanchard et al., were based on their code.
By the way if Matheson-Stavrev's Kalman Filter code has critical errors or faults, it might mean disaster - as far as I know many economists' papers such as Oliver Blanchard et al., were based on their code.
Re: Matheson-Stavrev EL 2013
Dear Mr.Doan,
Although you made me a code, I am still working on it. I am attaching the result of your code.
The problem is inequality constrainsts - kappa and gamma should be >=0, and theta should be o=< theta =< 1 as described in Matheson & Stavrev (2013). But in the result the values of kappa, gamma, and theta go different from constraints.
So, I hope that you improve the code with the inequality constraints of kappa, gamma, and theta.
Although you made me a code, I am still working on it. I am attaching the result of your code.
The problem is inequality constrainsts - kappa and gamma should be >=0, and theta should be o=< theta =< 1 as described in Matheson & Stavrev (2013). But in the result the values of kappa, gamma, and theta go different from constraints.
So, I hope that you improve the code with the inequality constraints of kappa, gamma, and theta.
Re: Matheson-Stavrev EL 2013
Part of the confusion is that they're referencing the wrong paper by Simon. Equality constraints are relatively simple and can be done exactly. Inequality constraints, no matter how you do them, aren't and can't. See
SIMON, D. J. (2010): “Kalman filtering with state constraints: a survey of linear and nonlinear algorithms,” IET Control Theory and Applications, pp. 1–16.
One of the big problems with the content of that survey is that (as it's from the Engineering literature), the dynamical models are considered to be known, and (probably in most cases), the constraints may be physical bounds. In Matheson and Stavrev, several parameters are not known and the constraints are due to interpretation rather than being physical. All "solutions" to KF with state inequality constraints are at best approximations, and you are then maximizing the likelihood over an approximation on what's itself an approximation (as the model has to be linearized).
SIMON, D. J. (2010): “Kalman filtering with state constraints: a survey of linear and nonlinear algorithms,” IET Control Theory and Applications, pp. 1–16.
One of the big problems with the content of that survey is that (as it's from the Engineering literature), the dynamical models are considered to be known, and (probably in most cases), the constraints may be physical bounds. In Matheson and Stavrev, several parameters are not known and the constraints are due to interpretation rather than being physical. All "solutions" to KF with state inequality constraints are at best approximations, and you are then maximizing the likelihood over an approximation on what's itself an approximation (as the model has to be linearized).
Re: Matheson-Stavrev EL 2013
Dear Mr. Doan,
In ekfexample.rpf long-term inflation expectations data are PTRPCE and PTRCPI and these are in CCKdata.PTRupdates.xlsx. I know tha you just used one series, PTRCPI.
Please let me know the exact names of these 2 series and data sources. I have searched their sources for a long time in the websites such as the Federal Reserve Bank Board and FRED but there was no such long-term inflation expectations starting in or before year 1960.
In ekfexample.rpf long-term inflation expectations data are PTRPCE and PTRCPI and these are in CCKdata.PTRupdates.xlsx. I know tha you just used one series, PTRCPI.
Please let me know the exact names of these 2 series and data sources. I have searched their sources for a long time in the websites such as the Federal Reserve Bank Board and FRED but there was no such long-term inflation expectations starting in or before year 1960.
Re: Matheson-Stavrev EL 2013
One is for PCE inflation (PTRPCE) and one for CPI inflation (PTRCPI). I got the extensions back to 1960 from Todd Clark who had a copy of those from when the FRB had data from on those from 1960 on.
Re: Matheson-Stavrev EL 2013
OK. Are both PTRPCE and PTRCPI 10 year inflation expectations or 5 year ones?
Re: Matheson-Stavrev EL 2013
Yes, both PTRPCE and PTRCPI are measures of 10-year ahead inflation expectations (averages of inflation rates 1 through 10 years ahead). For the period since the Survey of Professional Forecasters has been publishing long-run forecasts of CPI and PCE inflation, the PTR series are the same as the SPF series.
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Economic Research Dept.
Federal Reserve Bank of Cleveland
Re: Matheson-Stavrev EL 2013
I should have included this in the previous post. The most recently published series on PTR (for PCE) from the Fed Board is available at: https://www.federalreserve.gov/econres/ ... ackage.zip. In between updates to this FRB/US file, the series can be updated using the SPF forecasts.
Additional information on the FRB/US model in which the series are used is available here: https://www.federalreserve.gov/econres/ ... ackage.htm
Additional information on the FRB/US model in which the series are used is available here: https://www.federalreserve.gov/econres/ ... ackage.htm
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Economic Research Dept.
Federal Reserve Bank of Cleveland
Re: Matheson-Stavrev EL 2013
Thank you Mr.Doan and Mr.Clark.
Actually I have downloaded and skimed "a New Model of Inflation, Trend Inflation, and Long-Run Inflation Expectations" by Todd E.Clark et al. I just read ch 3. Data and found the authors used several kinds of long-run inflation expectations. However, it was not very clear how they were inputed specifically.
You told me that you used 'measures of 10-year ahead inflation expectations (averages of inflation rates 1 through 10 years ahead)'. Does this mean that you used 10 series (1 year inflation expectations, ..., 10 year inflation expectations) to make one series of long-run inflation expectations as a regression variable? If this is true, then this method cannot be applied to those countries who have only 5 year inflation expectations or 10 year one. Please let me know why we should use multiple-year averaged series instead of one time horizon (e.g. 10 year inflation expectations or 5 year inflation expectations) as a inflation expectations variable. Is it related to smoothing of series?
Actually I have downloaded and skimed "a New Model of Inflation, Trend Inflation, and Long-Run Inflation Expectations" by Todd E.Clark et al. I just read ch 3. Data and found the authors used several kinds of long-run inflation expectations. However, it was not very clear how they were inputed specifically.
You told me that you used 'measures of 10-year ahead inflation expectations (averages of inflation rates 1 through 10 years ahead)'. Does this mean that you used 10 series (1 year inflation expectations, ..., 10 year inflation expectations) to make one series of long-run inflation expectations as a regression variable? If this is true, then this method cannot be applied to those countries who have only 5 year inflation expectations or 10 year one. Please let me know why we should use multiple-year averaged series instead of one time horizon (e.g. 10 year inflation expectations or 5 year inflation expectations) as a inflation expectations variable. Is it related to smoothing of series?
Re: Matheson-Stavrev EL 2013 : ##MAT15
Dear Mr.Doan,
I am sorry for successive questions.
I ran a modified version of ekfexample.rpf as attached and got a situation as below.
## MAT15. Subscripts Too Large or Non-Positive
Error was evaluating entry 1
The Error Occurred At Location 289, Line 8 of loop/block
I thought that at least one of three causes as below might result in this problem.
(1) During fixing this problem, I found that the starting point in DO iteration is important.
The closer is it to the starting point of whole data set, the less the model fail in.
How could I fix the starting point in DO iteration in the data set as attached?
(2) I guess that one of the causes might be the short length of inflation expectations data (INFEXP1_1_KO, INFEXP1_2_KO, and INFEXP5_2_KO).
Or I wonder that the difference of starting points among variables could result in this error.
Should all variables' starting and ending points be coincident in this model ?
(3) Furthermore, the regression result is not good - independent varibles are not very significant.
Is these problem too?
I am sorry for successive questions.
I ran a modified version of ekfexample.rpf as attached and got a situation as below.
## MAT15. Subscripts Too Large or Non-Positive
Error was evaluating entry 1
The Error Occurred At Location 289, Line 8 of loop/block
I thought that at least one of three causes as below might result in this problem.
(1) During fixing this problem, I found that the starting point in DO iteration is important.
The closer is it to the starting point of whole data set, the less the model fail in.
How could I fix the starting point in DO iteration in the data set as attached?
(2) I guess that one of the causes might be the short length of inflation expectations data (INFEXP1_1_KO, INFEXP1_2_KO, and INFEXP5_2_KO).
Or I wonder that the difference of starting points among variables could result in this error.
Should all variables' starting and ending points be coincident in this model ?
(3) Furthermore, the regression result is not good - independent varibles are not very significant.
Is these problem too?
Re: Matheson-Stavrev EL 2013
Regarding your questions about the data and forecast horizon, you might have a look at the Survey of Professional Forecasters, published by the Federal Reserve Bank of Philadelphia. Their long-run forecast is the one commonly used in practice and in research, and as I indicated, it corresponds to the long-run forecast used in the FRB/US model. The horizon is the average rate one through ten years ahead, which is what the survey asks respondents to provide. They don't provide forecasts for each year; they provide just the forecast of the average rate for the next 10 years. Although this is commonly used, there is nothing sacrosanct about this specific horizon, and it shouldn't be a problem to use forecasts for other countries that cover somewhat different long-horizon periods (e.g., the proprietary forecasts from the company Consensus Economics cover a horizon of 6-10 years ahead).
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Economic Research Dept.
Federal Reserve Bank of Cleveland
Re: Matheson-Stavrev EL 2013
You have that set to estimate the combined model starting at the point where you have data to run the entire model. If you push the sample start earlier than that, DLM will use the data it has to help estimate the parameters governing the unemployment decomposition. However, the CONDITION=10 option applies beginning at the start of the estimation range, so when you hit the full data for the Phillips curve, that conditioning period is long since past, so the very poorly estimated early PC parameters will be used in computing the log likelihood.
The reality is that most (all??) of these types of models only "work" when quite a few rather strict assumptions are applied. After all, if the PC were really well-defined by the data, why would you need the bounds on the parameters?
The reality is that most (all??) of these types of models only "work" when quite a few rather strict assumptions are applied. After all, if the PC were really well-defined by the data, why would you need the bounds on the parameters?