Hi all,
I am running the code of DLW (2012) with using Stata 15. The command is meant to generate a matrix. But Stata gives an error message when I call the matrix. Please find the code below:
mata:
void GMM_DLW(todo,betas,crit,g,H)
{
PHI=st_data(.,("phi"))
PHI_LAG=st_data(.,("phi_lag"))
Z=st_data(.,("const","l_lag","k"))
X=st_data(.,("const","l","k"))
X_lag=st_data(.,("const","l_lag","k_lag"))
Y=st_data(.,("y"))
C=st_data(.,("const"))
OMEGA=PHI-X*betas'
OMEGA_lag=PHI_LAG-X_lag*betas'
OMEGA_lag_pol=(C,OMEGA_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)
crit
}
void DLW()
{
initialvalue=st_data(1,("blols","bkols"))
S=optimize_init()
optimize_init_evaluator(S,&GMM_DLW())
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,("OLS"))
p=optimize(S)
p
st_matrix("beta_dlw",p)
}
end
cap program drop dlw
program dlw, rclass
preserve
sort fid year
mata DLW()
end
dlw
gen beta_c1=beta_dlw[1,1]
when I call dlw, Stata gives an error message :
beta_ ambiguous abbreviation
st_data(): 3598 Stata returned error
DLW(): - function returned error
<istmt>: - function returned error
when I tried to generate variables from the matrix, Stata gives an error:
beta_dlw not found
Does anyone has an idea of why Stata does not generate or store the matrix?
I am running the code of DLW (2012) with using Stata 15. The command is meant to generate a matrix. But Stata gives an error message when I call the matrix. Please find the code below:
mata:
void GMM_DLW(todo,betas,crit,g,H)
{
PHI=st_data(.,("phi"))
PHI_LAG=st_data(.,("phi_lag"))
Z=st_data(.,("const","l_lag","k"))
X=st_data(.,("const","l","k"))
X_lag=st_data(.,("const","l_lag","k_lag"))
Y=st_data(.,("y"))
C=st_data(.,("const"))
OMEGA=PHI-X*betas'
OMEGA_lag=PHI_LAG-X_lag*betas'
OMEGA_lag_pol=(C,OMEGA_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)
crit
}
void DLW()
{
initialvalue=st_data(1,("blols","bkols"))
S=optimize_init()
optimize_init_evaluator(S,&GMM_DLW())
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,("OLS"))
p=optimize(S)
p
st_matrix("beta_dlw",p)
}
end
cap program drop dlw
program dlw, rclass
preserve
sort fid year
mata DLW()
end
dlw
gen beta_c1=beta_dlw[1,1]
when I call dlw, Stata gives an error message :
beta_ ambiguous abbreviation
st_data(): 3598 Stata returned error
DLW(): - function returned error
<istmt>: - function returned error
when I tried to generate variables from the matrix, Stata gives an error:
beta_dlw not found
Does anyone has an idea of why Stata does not generate or store the matrix?
Comment