EconForge / Dolo.jl

Economic modeling in Julia
Other
57 stars 29 forks source link

Restriction on the number of state variables #151

Open iglikav opened 5 years ago

iglikav commented 5 years ago

I am using dolo to simulate a DSGE model. However, I cannot load any model with more than 5 state variables using the yaml_import command. No error messages are displayed, just the loading continues until the kernel dies. If any of the transition equations is dropped then the model is loaded with no problem. Is there a restriction on the number of state variables? Please find below a small example model. Thank you very much!

name: min

symbols:

   exogenous: [Y]
   controls: [C]
   states: [K, G, X, B, Tr, CG]
   parameters: [beta, delta, nu, r_B, sig_z,
               rho_X, rho_B, rho_Tr, rho_CG, 
               CGoY, KoY, BoY, TroY, XoY,
               REV, I, r]

equations:

    arbitrage:
        - 1-beta*C/C(1)*(1-delta)          | 0 <= C <= inf

    transition:
        - K = (1-delta)*K(-1) + I + r*K(-1) - C(-1)
        - G = (1-nu)*G(-1) + X(-1) 
        - X = rho_X*X(-1)+(1-rho_X)*XoY*Y(-1)
        - B = (1+r_B)*B(-1) - REV + X(-1) + CG(-1) + Tr(-1)
        - Tr = rho_Tr*Tr(-1)+(1-rho_Tr)*TroY*Y(-1)
        - CG=rho_CG*CG(-1)+(1-rho_CG)*CGoY*Y(-1)

calibration:

    # parameters
    beta : 0.99
    delta: 0.04
    nu: 0.03
    r_B: 0.005
    sig_z: 0.0

    rho_X: 0.5
    rho_Tr: 0.9
    rho_CG: 0.9

    CGoY: 0.11
    KoY: 3
    BoY: 0.2
    TroY: 0.14

    Y: 1

    REV: 0.16*Y
    I: 0.3*Y

    CG: CGoY*Y 
    K: KoY*Y 
    Tr: TroY*Y
    B: BoY*Y

    r: (1-beta*(1-delta))/beta
    C: (r-delta*K) + I
    X: REV - r_B*B - CG
    G: X/nu
    XoY: X  

exogenous: !Normal
    Sigma: [[sig_z^2]]

domain:
    K: [K*0.5, K*1.5]
    G: [G*0.5, G*1.5]
    X: [X*0.5, X*1.5]
    B: [B*0.5, B*1.5]
    Tr: [Tr*0.5, Tr*1.5]
    CG: [CG*0.5, CG*1.5]

options:
    grid: !Cartesian
        orders: [20,20,20,20,20,20]
albop commented 5 years ago

Thank you @iglikav . There should not be a limit on the number of states when you import the model. Maybe the problem stems from the cartesian grid which has 20^6 points. This should not be a problem when it comes to construct it (you won't be able to solve the model on that grid but you can try perturbations). We'll investigate.

iglikav commented 5 years ago

I decreased the number of the points in the grid to 10^6 and my full-scale model was loaded and solved using the perfect foresight algorithm with no problem. Thank you very much!