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?
Related Posts with Stata not storing my matrix in Mata
Separating string variable with parenthesis and commasHello,
I have variable that looks like
Experience
('Santo Engineering', '2017-04-30', '2017-05-30'…
how do do a rolling WLS in stataI would like to run a rolling regression in Stata, where in each window the weights of independent v…
Why the logical in Stata of calculating missing observation is quite strangeToday I calculate
Code:
gen year1a=1 if yr <=ei +1
While ei=. and yr=1990, I saw the result of …
Bar graph with confidence intervals and character group labelsSo this bothers me for a while. I want to have a bar graph for group means with confidence intervals…
How to run a regression using weight by the number of children to each parentDear all,
I want to examine the effects of children' s characteristics on their parent health outco…
Subscribe to:
Post Comments (Atom)
0 Response to Stata not storing my matrix in Mata
Post a Comment