fixed bugs in prior density and unconstrained optimization #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugs 2 and 3 are two remaining bugs from my previous pull request.
Bug 1: Rstard should be defined as (1 + Rstarn/100)bstar
Proof: Rstarn was defined as 100(rstar*pistar-1) and used in measurement equations for short-term and long-term nominal interest rates and expected FFR.
Bug 2: Labor can not be normalized to one (as in SW) since it violates FOC for labor in the steady state.
Proof: This was mentioned in appendix (page 58) but not implemented in the code.
Bug 3: missing term z_{t-1} and incorrect coefficient for term z_t in Phillips curve for wages
Proof: If we take wage Phillips curve (equation 13 in SW) and replace pi_t with pi_t+z_t then we don't get the same equation as 8.106.
Bug 4: incorrect prior density of inverse-gamma distribution, the standard deviation parameter should not be squared since it is already transformed from real line to positive numbers
Proof: correct PDF is given at https://en.wikipedia.org/wiki/Scaled_inverse_chi-squared_distribution
where parameters are: tau=a, nu=b and x=para(i) (not para(i)^2)
Bug 5: the mode is constrained at the upper boundary on parameter rho_sigw
Proof: Unconstrained minimization algorithm such as csminwel requires rescaling of constrained parameters. The problem is that we don't know if any of the constraints will become binding at the mode. For example, parameter rho_sigw becomes binding at the upper boundary 0.99 that was imposed in original v990 code (as evidenced from output from IRIS optimizer fmincon). That caused the csminwel to slow down to a crawl since the unscaled parameter tried to go to infinity. I therefore had to increase this upper limit to 0.999 (since the mode is at 0.9945). As a result the Julia csminwel code which was running several days, now runs in 4 hours after binding constraint on rho_sigw was removed. We can avoid this problem in IRIS by using constrained minimization method such as fmincon (with active-set algorithm), which can estimate the model in 5 minutes.