Ejemplo n.º 1
0
def test_eval_formula():

    from dolo.compiler.eval_formula import eval_formula
    from dolo import yaml_import, approximate_controls, simulate

    model = yaml_import('examples/models/rbc.yaml')
    dr = approximate_controls(model)
    sim = simulate(model, dr)

    rr = eval_formula("delta*k-i", sim, context=model.calibration)
    rr = eval_formula("y(1) - y", sim, context=model.calibration)

    sim['diff'] = model.eval_formula("delta*k-i", sim)
    model.eval_formula("y(1) - y", sim)
    sim['ddiff'] = model.eval_formula("diff(1)-diff(-1)", sim)
Ejemplo n.º 2
0
def test_eval_formula():

    from dolo.compiler.eval_formula import eval_formula
    from dolo import yaml_import, time_iteration, simulate

    model = yaml_import('examples/models/rbc.yaml')
    dr = time_iteration(model)
    sim = simulate(model, dr)
    sim = sim.sel(N=0)
    sim = sim.to_pandas()

    rr = eval_formula("delta*k-i", sim, context=model.calibration)
    rr = eval_formula("y(1) - y", sim, context=model.calibration)

    sim['diff'] = model.eval_formula("delta*k-i", sim)
    model.eval_formula("y(1) - y", sim)
    sim['ddiff'] = model.eval_formula("diff(1)-diff(-1)", sim)
Ejemplo n.º 3
0
def test_custom_dr():

    from dolo import yaml_import, simulate, time_iteration
    import numpy as np
    from dolo.numeric.decision_rule import CustomDR

    model = yaml_import("examples/models/rbc.yaml")

    values = {"n": "0.33 + z*0.01", "i": "delta*k-0.07*(k-9.35497829)"}

    edr = CustomDR(values, model)

    m0, s0 = model.calibration["exogenous", "controls"]

    edr(m0, s0)

    sim = simulate(model, edr, s0=np.array([0.0, 8.0]))

    time_iteration(model, dr0=edr)
Ejemplo n.º 4
0
def test_custom_dr():

    from dolo import yaml_import, simulate, time_iteration
    import numpy as np
    from dolo.numeric.decision_rule import CustomDR

    model = yaml_import('examples/models/rbc.yaml')

    values = {'n': '0.33 + z*0.01', 'i': 'delta*k-0.07*(k-9.35497829)'}

    edr = CustomDR(values, model)

    m0, s0 = model.calibration['exogenous', 'controls']

    edr(m0, s0)

    sim = simulate(model, edr, s0=np.array([0.0, 8.0]))

    time_iteration(model, initial_guess=edr)
Ejemplo n.º 5
0
def test_eval_formula():

    from dolo.compiler.eval_formula import eval_formula
    from dolo import yaml_import, time_iteration, simulate
    import dolo.config

    from dolo import perturb

    model = yaml_import("examples/models/rbc.yaml")

    dr = perturb(model)
    sim = simulate(model, dr)
    sim = sim.sel(N=0)
    sim = sim.to_pandas()

    print(sim.columns)
    rr = eval_formula("delta*k(0)-i(0)", sim, context=model.calibration)
    rr = eval_formula("y(1) - y(0)", sim, context=model.calibration)

    sim["diff"] = model.eval_formula("delta*k(0)-i(0)", sim)
    model.eval_formula("y(1) - y(0)", sim)
    sim["ddiff"] = model.eval_formula("diff(1)-diff(-1)", sim)
Ejemplo n.º 6
0
def test_eval_formula():

    from dolo.compiler.eval_formula import eval_formula
    from dolo import yaml_import, time_iteration, simulate
    import dolo.config

    from dolo import perturb

    model = yaml_import('examples/models/rbc.yaml')

    dr = perturb(model)
    sim = simulate(model, dr)
    sim = sim.sel(N=0)
    sim = sim.to_pandas()


    print(sim.columns)
    rr = eval_formula("delta*k(0)-i(0)", sim, context=model.calibration)
    rr = eval_formula("y(1) - y(0)", sim, context=model.calibration)

    sim['diff'] = model.eval_formula("delta*k(0)-i(0)", sim)
    model.eval_formula("y(1) - y(0)", sim)
    sim['ddiff'] = model.eval_formula("diff(1)-diff(-1)", sim)