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!
Related Posts with Mata Steps
Using summarize after svy: mean with direct standardisationHello, I am running the descriptive statistics for continuous variable that contains number of visi…
random intercept in mixed effect modelDear all, I am trying to run a mixed effect model across 10 different clinical trials to obtain int…
empty model in mulitple imputations framework (mixed models)Dear all, I am currently analyzed data with missing data. In complete case analysis framework, the…
Creating District Month PanelDear All, I hope you are doing well. I wanted to create two dataset from my raw data 1) district da…
Generate dummy from stringsDear members, Below is my data column where respondents selected various sources of water. I would l…
Subscribe to:
Post Comments (Atom)
0 Response to Mata Steps
Post a Comment