Announcement

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

  • Mata Steps

    Hi All,

    I want to estimate productivity and the Beta's

    I am running the GMM in MATA:

    My program file is as follows:

    Step 1:
    Simple OLS to get the initial Beta values.

    reg logdeflatedrevenue logcapital logmaterials loglabor

    gen bols_l=_b[ loglabor ]
    gen bols_k=_b[ logcapital ]
    gen bols_m=_b[ logmaterials ]

    reg logdeflatedrevenue logcapital logmaterials loglabor laglogcap lagloglab laglogmat

    predict phi
    gen phi_lag=L.phi

    Step 2:
    . mata
    ------------------------------------------------- mata (type end to exit) -----------------------------------------------
    : void GMM_DL(todo,betas,crit,g,H)
    > {
    > PHI=st_data(.,("phi"))
    > PHI_LAG=st_data(.,("phi_lag"))
    > Z=st_data(.,(" laglogcap lagloglab laglogmat "))
    > X=st_data(.,(" logcapital logmaterials loglabor "))
    > X_lag=st_data(.,(" laglogcap lagloglab laglogmat" ))
    > Y=st_data(.,(" logdeflatedrevenue "))
    > QR_lag=st_data(.,(" logprevioustariff "))
    > C=st_data(.,("const"))
    > OMEGA=PHI-X*betas'
    > OMEGA_lag=PHI_LAG-X_lag*betas'
    > OMEGA_lag_pol=(C,OMEGA_lag,QR_lag)
    > g_b = invsym(OMEGA_lag_pol'OMEGA_lag_pol)*OMEGA_lag_pol' OMEGA
    > XI=OMEGA-OMEGA_lag_pol*g_b
    > crit=(Z'XI)'(Z'XI)
    > }



    : void DL()
    > {
    > S=optimize_init()
    > optimize_init_evaluator(S, &GMM_DL())
    > optimize_init_evaluatortype(S,"d0")
    > optimize_init_technique(S, "nm")
    > optimize_init_nmsimplexdeltas(S, "select value")
    > optimize_init_which(S,"min")
    > optimize_init_params(S,(" bols_l bols_k bols_m "'))
    > p=optimize(S)
    > p
    > st_matrix("beta_DL",p)
    > }

    : end
    -------------------------------------------------------------------------------------------------------------------------

    cap program drop dl
    program dl, rclass
    preserve
    sort N time
    mata DL()
    end


    Question: what is my next step? how can I get OMEGA and my beta's?? Can anyone share a link or some steps. Will this estimate productivity using LP or OP? What are the next commands?

    Thanks!
Working...
X