GithubHelp home page GithubHelp logo

llorracc / cstwmpc Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 17.0 28.89 MB

The Distribution of Wealth and the Marginal Propensity to Consume

Mathematica 16.61% M 0.03% TeX 3.91% C 0.09% MATLAB 0.20% PostScript 77.33% Stata 0.51% Shell 0.02% Python 1.03% Roff 0.01% Jupyter Notebook 0.27%

cstwmpc's Issues

Clean out legacy code from development branch

After #5 , a development branch for this repository should be chosen.

This branch should only contain that code which is relevant to the functioning of the REMARK.

There is a lot of legacy code here, including apparently a copy of HARK.
Even if there is valuable legacy code in this repository, there's no need to have it in the development branch: it will always be available in the stable release cut before it was removed.

Issue with parallel warning

When you try to run do_min.py, during the execution of the beta distribution model, you get the following output:

Beginning an estimation with the specification name PYbetaDistIndNetWorth...
getKYratioDifference tried center = 0.95 and got -9.73574471397209
getKYratioDifference tried center = 0.995 and got 108.10737279427268
getKYratioDifference tried center = 0.953717726766 and got -9.701892400680814
getKYratioDifference tried center = 0.974358863383 and got -9.318167745132815
getKYratioDifference tried center = 0.984679431691 and got -6.177290169150552
getKYratioDifference tried center = 0.989839715846 and got 14.451949165200366
getKYratioDifference tried center = 0.986224644875 and got -3.033018049642135
getKYratioDifference tried center = 0.987456628336 and got 0.9310485365679941
getKYratioDifference tried center = 0.987167269826 and got -0.14252313644736248
getKYratioDifference tried center = 0.98720568392 and got -0.005530837946649214
getKYratioDifference tried center = 0.987207225666 and got 2.3644569774106117e-05
getKYratioDifference tried center = 0.987206725666 and got -0.001770311032350591
findLorenzDistanceAtTargetKY tried spread = 0.006 and got 10.557361576875467
getKYratioDifference tried center = 0.95 and got -9.734329349907803
getKYratioDifference tried center = 0.995 and got 150.10485470647563
getKYratioDifference tried center = 0.95274053464 and got -9.709581660552622
getKYratioDifference tried center = 0.97387026732 and got -9.317729861064027
getKYratioDifference tried center = 0.98443513366 and got -4.2048296989541445
getKYratioDifference tried center = 0.98971756683 and got 23.17116211727427
getKYratioDifference tried center = 0.98524649173 and got -2.2595894490413553
getKYratioDifference tried center = 0.986105223383 and got 0.41503113163824246
getKYratioDifference tried center = 0.985971970699 and got -0.04742782606564511
getKYratioDifference tried center = 0.985985636528 and got -0.0008789954362544705
getKYratioDifference tried center = 0.985986136528 and got 0.0008280712433954562
findLorenzDistanceAtTargetKY tried spread = 0.008 and got 4.926370337581616
getKYratioDifference tried center = 0.95 and got -9.73111352958761
Traceback (most recent call last):

  File "<ipython-input-1-0e9883c01aa9>", line 1, in <module>
    runfile('U:/gsr_2019/REMARK/REMARKs/cstwMPC/do_min.py', wdir='U:/gsr_2019/REMARK/REMARKs/cstwMPC')

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 95, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "U:/gsr_2019/REMARK/REMARKs/cstwMPC/do_min.py", line 27, in <module>
    exec(open('cstwMPC_MAIN.py').read())

  File "<string>", line 681, in <module>

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\_minimize.py", line 771, in minimize_scalar
    return _minimize_scalar_brent(fun, bracket, args, **options)

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\optimize.py", line 2115, in _minimize_scalar_brent
    brent.optimize()

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\optimize.py", line 1899, in optimize
    xa, xb, xc, fa, fb, fc, funcalls = self.get_bracket_info()

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\optimize.py", line 1876, in get_bracket_info
    xb=brack[1], args=args)

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\optimize.py", line 2304, in bracket
    fc = func(*((xc,) + args))

  File "<string>", line 679, in <lambda>

  File "<string>", line 523, in findLorenzDistanceAtTargetKY

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\scipy\optimize\zeros.py", line 754, in brentq
    r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output, disp)

  File "<string>", line 522, in <lambda>

  File "<string>", line 483, in getKYratioDifference

  File "<string>", line 172, in solve

  File "C:\Users\bdwyer\AppData\Local\Continuum\anaconda3\envs\py2\lib\site-packages\econ_ark-0.10.1.dev3-py2.7.egg\HARK\core.py", line 979, in solveAgents
    if self.print_parallel_error_once:

AttributeError: 'cstwMPCmarket' object has no attribute 'print_parallel_error_once'

If you comment out lines 976-86 of core.py in HARK and re-indent, as below:

        # try:
        #     multiThreadCommands(self.agents, ['solve()'])
        # except Exception as err:
        #     if self.print_parallel_error_once:
        #         # Set flag to False so this is only printed once.
        #         self.print_parallel_error_once = False
        #         print("**** WARNING: could not execute multiThreadCommands in HARK.core.Market.solveAgents() ",
        #               "so using the serial version instead. This will likely be slower. "
        #               "The multiTreadCommands() functions failed with the following error:", '\n',
        #               sys.exc_info()[0], ':', err)  # sys.exc_info()[0])
        multiThreadCommandsFake(self.agents, ['solve()'])

the error does not arise. I suspect there's some error in the way the print_parallel_error_once attribute of the Market class is being inherited by the cstwMPCmarket when the solution is parallelized.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.