Exemplo n.º 1
0
def test_dsgenormal():
    """
    Run basic model to verify working.
    """
    inputdict = getinputdict()

    sys.path.append(str(__projectdir__ /
                        Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    discretelineardsgefull(inputdict)
def solvefulldsge(p):
    inputdict = getinputdict_full(p)

    sys.path.append(str(__projectdir__ /
                        Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    inputdict = discretelineardsgefull(inputdict)
Exemplo n.º 3
0
def main(Rshock=True, Ishock=False, numshockperiods=50):
    """
    We see that the only way this yields a solution is if Pi is a state.
    """
    inputdict = {}
    inputdict['equations'] = [
        'Pihat = KAPPA * Xhat + BETA * Pihat_p',
        'Xhat = Xhat_p - 1/GAMMA*(Ihat - Pihat_p - Rnhat)',
        'Ihat = PHIpi * Pihat + PHIy * Xhat + Rnhat + ui_0',
        'Rp = Ihat - Pihat_p'
    ]
    for i in range(numshockperiods - 1):
        # 'ui_0_p = ui_1'
        inputdict['equations'].append('ui_' + str(i) + '_p = ui_' + str(i + 1))
    # 'ui_11_p = 0'
    inputdict['equations'].append('ui_' + str(numshockperiods - 1) + '_p')

    inputdict['paramssdict'] = {
        'BETA': 0.98,
        'KAPPA': 1,
        'GAMMA': 1,
        'PHIpi': 1.5,
        'PHIy': 0
    }

    inputdict['controls'] = ['Xhat', 'Pihat', 'Ihat', 'Rp']
    inputdict['states'] = [] + ['ui_' + str(i) for i in range(numshockperiods)]
    inputdict['shocks'] = ['Rnhat']

    inputdict['mainvars'] = ['Xhat', 'Pihat', 'Rp', 'Ihat']
    inputdict['showirfs'] = []

    inputdict['loglineareqs'] = True
    sys.path.append(str(__projectdir__ /
                        Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    discretelineardsgefull(inputdict)

    if Rshock is True:
        Rshockvec = [-0.01] * numshockperiods
        from getshocks_func import getshocks_fixvar
        getshocks_fixvar(inputdict, Rshockvec, 'Rp', 'ui_')

    if Ishock is True:
        Ishockvec = [-np.log(1 / 0.98)] * numshockperiods
        from getshocks_func import getshocks_fixvar
        getshocks_fixvar(inputdict, Ishockvec, 'Ihat', 'ui_')
Exemplo n.º 4
0
def full():
    inputdict = getinputdict()
    inputdict['savefolder'] = __projectdir__ / Path('me/temp/')

    sys.path.append(str(__projectdir__ / Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    inputdict = discretelineardsgefull(inputdict) 

    return(inputdict)
Exemplo n.º 5
0
def polfunc():
    
    sys.path.append(str(__projectdir__ / Path('dsgesetup')))
    from rbc_simple import getinputdict
    inputdict = getinputdict()

    inputdict['savefolder'] = __projectdir__ / Path('dsge_bkdiscrete/temp_bkfull/')

    # add model
    sys.path.append(str(__projectdir__ / Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    inputdict = discretelineardsgefull(inputdict) 
Exemplo n.º 6
0
def main():
    """
    Direct shocks.
    """
    inputdict = {}
    inputdict['dynareequations'] = [
        '1/c - BETA * 1/c(+1)*(ALPHA*a(+1)*k(0)**(ALPHA-1) + (1-DELTA))',
        'c + k - a*k(-1)**ALPHA - (1-DELTA)*k(-1)',
        'log(a)-RHO*log(a(-1)) - epsilon_a'
    ]

    inputdict['paramssdict'] = {
        'ALPHA': 0.3,
        'BETA': 0.95,
        'DELTA': 0.1,
        'RHO': 0.9
    }

    p = inputdict['paramssdict']
    v = {}
    v['am1'] = 1
    v['a'] = 1
    v['k'] = ((p['ALPHA'] * v['a']) /
              (1 / p['BETA'] - 1 + p['DELTA']))**(1 / (1 - p['ALPHA']))
    v['c'] = v['a'] * v['k']**p['ALPHA'] - p['DELTA'] * v['k']

    inputdict['dynarevariables'] = ['a', 'k', 'c']
    inputdict['shocks'] = ['epsilon_a']
    inputdict['savefolder'] = __projectdir__ / Path('me/basic/short/temp/')
    inputdict['dynarevarssdict'] = v

    inputdict['dynarelogvars'] = ['a', 'k', 'c']

    sys.path.append(str(__projectdir__ /
                        Path('submodules/dsge-perturbation/')))
    from dsge_bkdiscrete_func import discretelineardsgefull
    discretelineardsgefull(inputdict)