You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
Hi Alice. May I recommend that you use code tags for program listings? And more importantly, consider using dataex from SSC or built into Stata 15.1, to provide some sample data. That would make it easier for forum members to help troubleshoot your problem and test potential solutions.
In the meantime a preliminary suggestion. Consider copying the data from Stata to Mata just once rather that on every iteration. You can then pass the data as extra arguments to the evaluator or declare them as external, which is probably easier. The next task would be to make sure that GMM_DLW() works, calling it with your starting values. I find that I rarely need to specify a technique, as the defaults usually work.
end
*-----------------------------------------END MATA PROGRAM---------------------------------------*
cap program drop dlw
program dlw, rclass
preserve
sort firmid yearaccount
mata DLW()
end
*------------------------------------OLS estimates-----------------------------------------------*
reg y l k i.yearaccount
gen beta_lols=_b[l]
gen beta_kols=_b[k]
*------------------------------------ACF estimates-----------------------------------------------*
dlw
The code runs just fine until the previous line "dlw", and shows the return error stating "missing value returned by evaluator". i also tried different approach just like Alice did (different techniques, different initial values), but it either shows initial values not feasible" or "missing values returned by evaluator"
Below is a sample of my data. Would you mind checking what's wrong? I try to figure out what's wrong with the code or my data, but since I'm new to Mata, it's still quite hard for me to see through. I would be much appreciated to receive your comments. Thank you!
I've been having the same problems as you recenly. Because there was a data leak in my memory before entering the mata environment, so the mata environment can't identify it. I checked the variables that will be used in the mata’s function, and found that there were missing values in some variables. So, I deleted the missing values before entering the mata environment. Then my problem was solved. In addition, there are references also show that the inappropriate initial value setting may also cause such a mistake. Hopefully this will help you or anyone else with the same problem.
Comment