Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • dynare dynare
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 118
    • Issues 118
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynareDynare
  • dynaredynare
  • Issues
  • #1389
Closed
Open
Issue created Feb 05, 2017 by Johannes Pfeifer@JohannesPfeiferDeveloper

Check detrending engine

The mod-file


//-----------------------------------------------------------------------//
//---------------------- Declaring parameters ---------------------------//
//-----------------------------------------------------------------------//
parameters  delta	//depreciation
            sigma	//intertemporal elasticity
            beta	//discount factor
            alpha   //production function parameter
	        mu      //utility parameter
            theta   //Calvo parameter
            epsilon //elasticity
            chi     //indexation parameter (unused for now)
            ;

            alpha = 0.667;
            delta = 0.1;
            sigma = 0.25;
            beta = 0.96;
            mu = 0.2;
            theta = 0.5;
            epsilon = 15;
            chi = 0;

//-----------------------------------------------------------------------//
//----------------------- Declaring variables ---------------------------//
//-----------------------------------------------------------------------//
varexo omega //probability of remaining a worker in the next period
       gamma //probability of dieing (once retired)
       n     //populational growth
       x     //rate of technological change
       M_d   //exogenous money supply
       ;

var lambda      //asset distribution in the economy
    pi          //}these define the marginal propensity of consumption
    eps         //}by both retirees and workers (I'm using Gertler's notation)
    OMEGA       //higher case omega
    R           //gross interest rate
    PSI         //auxiliar variable
    mc          //marginal cost
    Pi          //inflation
    Df          //nominal dividends
    Pf          //nominal firm share price
    price_disp  //price dispersion index
    ;

//declaring nonstationary variables
trend_var(growth_factor= (1+x)*(1+n)/(1+n)) X; //technological progress
trend_var(growth_factor= (1+x)*(1+n)/(1+x)) N; //population

var(deflator = X*N)
                    Y            //product
                    C            //consumption
                    K            //financial capital
                    H            //non-financial capital
                    A            //assets
                    ;

var(deflator = X) W;             //real wage
var(deflator = 1/(X*N)) P PStar; //price level and optimal price set

var(deflator = (X*N)^(1-epsilon)) g1; //auxiliary Calvo variable
var(deflator = (X*N)^(2-epsilon)) g2; //auxiliary Calvo variable

predetermined_variables K; //timing convention

//-----------------------------------------------------------------------//
//------------------------------- Model ---------------------------------//
//-----------------------------------------------------------------------//

model;
    // Consumer side
    //1
    K(+1) = Y - C + (1 - delta)* K;
    //2
    (lambda - (1 - omega(+1)))*A = omega(+1)*(1-eps*pi)*lambda(-1)*R*A(-1);
    //3
    pi = 1 - PSI(+1) * (R(+1) * OMEGA(+1))^(sigma - 1) * beta^sigma * pi/pi(+1);
    //4
    eps * pi = 1 - PSI(+1) * ((R(+1))^(sigma-1)*beta^sigma*gamma(+1))*(eps*pi)/(eps(+1)*pi(+1));
    //5
    OMEGA = omega + (1-omega)*eps^(1/(1-sigma));
    //6
    H = N * W + H(+1)/((1+n(+1))*(1+x(+1))*R(+1)*OMEGA(+1)/omega(+1));
    //7
    C * (1 + mu^sigma * (R(+1)*Pi(+1)/(R(+1)*Pi(+1)-1))^(sigma-1)) = pi * ((1 + (eps/gamma-1) * lambda(-1)) * R * A(-1) + H(-1)); 
    //8  
    A = K + 1/R * M_d(+1)/P + Pf/P;
    //9
	PSI = (1 + ((R*Pi-1)/(R*Pi))^(sigma-1) * mu^sigma)^(-1) / (1 + (((R(+1)*Pi(+1))-1)/(R(+1)*Pi(+1)))^(sigma-1) * mu^sigma)^(-1);

    // Firm side
    //10	
    Y = (X * N)^alpha * (K)^(1-alpha)/price_disp;
    //11
    W = alpha * Y / N * mc;
    //12
    R = (1 - alpha) * Y / K * mc + 1 - delta; 
    //13
    mc = (1/(1-alpha))^(1-alpha)*(1/alpha)^alpha*(W/X)^(1-alpha)*(R-(1-delta))^alpha;
    
    // Calvo pricing
    //14
    PStar = epsilon/(epsilon-1) * g1/g2;
    //15
    g1 = P^epsilon * Y * mc + theta*beta * g1(+1);
    //16
    g2 = P^(epsilon-1) * Y + theta*beta * g2(+1);
    //17
    P = (theta * P(-1)^(1-epsilon) + (1-theta) * PStar^(1-epsilon))^(1/(1-epsilon));
    //18
    price_disp = theta*(PStar/P)^(-epsilon)*(P/P(-1))^(epsilon) + (1-theta)*(P/P(-1))^(epsilon)*price_disp(-1);
    //19
    Pi = P/P(-1);

    // Dividends and share prices
    Df = P * Y *(1-mc);
    Pf(+1) + Df(+1) = R(+1) * Pf;
end;

//-----------------------------------------------------------------------//
//--------------------------- Initial Values ----------------------------//
//-----------------------------------------------------------------------//

initval;
    M_d = 1; P =1;
    x = 0.01;
    n = 0.01;
    omega = 0.97;
    gamma = 0.9;
    
    lambda    =0.3878;
    pi        =0.2394;
    eps       =1.2832;
    OMEGA     =1.0124;
    R         =1.3968;
    PSI       =0.9988;
    mc        =0.9064;
    Y         =0.7407;
    C         =0.6857;
    K         =0.459;
    H         =1.4279;
    A         =1.365;
    P         =0.972;
    PStar     =0.9364;
    W         =0.448;
    Pi        =0.98;
    Df        =0.0681;
    Pf        =0.1732;
    price_disp=1.0336;
    g1        =0.601;
    g2        =0.6877;


end;
model_diagnostics;
steady;

endval;
    gamma = 0.94;
end;
steady;

simul(periods=300);

from http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=14206 does not run with

ERROR: the second-order cross partial of equation 14 w.r.t. trend variable X and endogenous variable PStar is not null. 

but the relevant equation

    PStar = epsilon/(epsilon-1) * g1/g2;

should have the trends specified (as far as I can see). g1/g2=((X*N)^(1-epsilon))/((X*N)^(2-epsilon)=(XN)^(-1), which is the trend for PStar.

Assignee
Assign to
Time tracking