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
STATA commands for Factor analysis with robust covariance matrixHi Statalist members Does anyone know what STATA commands/ set of commands can be used to run a fac…
Reshape data from time intervals to panel dataDear Statalisters, I have a dataset which records the change of a variable X over time for differen…
Appending data sets with the same variable names that have different content failsDear Statas, I have 7 datasets of the same study with the same variable names but differing content…
Explaining Experimental data with EUT or PT: Using Structural Equation modeling or Fixed Mixture model?Dear All, I will try to be as clear as possible. Some background: I am doing experiments in economi…
Cofusion between pooled Tobit and xttobitHi Everyone! I'm using Stata/SE 15.1 I have an unbalanced panel data I wanted to compare coeffici…
Subscribe to:
Post Comments (Atom)
0 Response to Mata Steps
Post a Comment