OpenSourceEconomics / ruspy

Python package for the simulation and estimation of a prototypical infinite-horizon dynamic discrete choice model based on Rust (1987)
http://ruspy.readthedocs.io
MIT License
22 stars 8 forks source link

MPEC Implementation #43

Closed Pascalheid closed 4 years ago

Pascalheid commented 4 years ago

I have been setting up MPEC using nlopt. So far the results don't come out exactly right and differ quite significantly depending on the max number of iterations and the algorithm used. I seek to implement analytical derivatives for the objective and the constraint to check if the results get better.

codecov[bot] commented 4 years ago

Codecov Report

Merging #43 into master will decrease coverage by 8.87%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
- Coverage   90.75%   81.87%   -8.88%     
==========================================
  Files          28       30       +2     
  Lines         941     1043     +102     
==========================================
  Hits          854      854              
- Misses         87      189     +102     
Impacted Files Coverage Δ
ruspy/estimation/estimation_mpec.py 0.00% <0.00%> (ø)
ruspy/estimation/estimation_mpec_functions.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5af454f...c8f10ce. Read the comment docs.

Pascalheid commented 4 years ago

I have now implemented analytical derivatives for both the objective function and the constraints for MPEC. The problem regarding the dependence on the max number of iterations is also solved. The algorithm now actually converges and I tried that out by replicating the results of 250 data sets that I have simulated using the matlab code provided by Iskhakov. I get basically the same results as they do with both our ruspy NFXP as well as our new ruspy MPEC.