Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I obtain convergent coefficients when using the "optimize" function in Mata for estimating the production function?

    Hello everyone, I am looking to apply the method of De Loecker and Warzynski (2012) and use the "optimize" function in the Mata environment to estimate production functions, specifically the Cobb-Douglas (CD) and Translog functions. However, I am facing an issue where I obtain a convergent warning for some industries (for each industry estimating production function seperately). To illustrate the issue, I used the Cobb-Douglas production function as an example. The code is as follows:

    Code:
    clear mata
    mata:
    
    void GMM_DLW_CD(todo,betas,crit,g,H)
    {
    PHI=st_data(.,("phi"))
    PHI_LAG=st_data(.,("phi_lag"))
    Z=st_data(.,("const","m_lag","l_lag","k"))
    X=st_data(.,("const","m","l","k"))
    X_lag=st_data(.,("const","m_lag","l_lag","k_lag"))
    Y=st_data(.,("lnoutput"))
    C=st_data(.,("constant"))
    
    OMEGA=PHI-X*betas' //OMEGA denoting productivity, is equal to the residual of total output minus inputs.
    OMEGA_lag=PHI_LAG-X_lag*betas'
    OMEGA_lag_pol=(C,OMEGA_lag)  //Productivity follows a first-order Markov process
    g_b = invsym(OMEGA_lag_pol'OMEGA_lag_pol)*OMEGA_lag_pol' OMEGA //least square method
    XI=OMEGA-OMEGA_lag_pol*g_b //Changes in productivity(residuals) that cannot be explained by the previous period
    crit=(Z'XI)'(Z'XI) //residuals is uncorrelated with previous period information
    }
    
    void DLW_CD()
    {
    initialvalue=st_data(1,("initialConst","initialm", "initiall","initialk"))
    S=optimize_init()
    optimize_init_evaluator(S, &GMM_DLW_CD())
    optimize_init_evaluatortype(S,"d0")
    optimize_init_technique(S, "nm")
    optimize_init_nmsimplexdeltas(S, 0.1)
    optimize_init_which(S,"min")
    optimize_init_params(S,initialvalue)
    p=optimize(S)
    p
    st_matrix("beta_DLW_CD",p)
    }

    The warning is following. What puzzles me is that (1)I can still get the estimated coefficients. Can I trust these coefficients(output elasticity respect to inputs)? (2) I would like to ask how to construct gradient vectors or hessian matrix of objective function "crit" which does not directly include the parameter betas to be estimated, so I can improve convergent efficiency. (3) Or is there another way I can make the objective function converge? Thanks very much.

    Code:
    Iteration 297: f(p) = 1.7590459
    Iteration 298: f(p) = 1.7590459
    Iteration 299: f(p) = 1.7590459
    Iteration 300: f(p) = 1.7590459
    convergence not achieved
    1 2 3 4
    +-------------------------------------------------------------+
    1 | 1.879356738 -.2856812546 .147107382 1.038800582 |
    +-------------------------------------------------------------+




Working...
X