Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: MLE method Could not find feasible values

 From "li.jie372@gmail.com" To "statalist@hsphsun2.harvard.edu" Subject st: MLE method Could not find feasible values Date Sun, 22 Dec 2013 10:22:34 +0800

```I am currently trying to program my own patent value elimination models
using Statas ml command, and I have got a original code that one author had
used for the same question. And my model is a bit different with his one.
So I have to make some adapt. So far, my attempts have not been very
successful. I have checked the help files of Stata, Statalist and gone
through the book of William Gould et al. on programming maximum likelihood
in Stata (they have some advice on ml check but I cannot fix the problem)
and have asked people at my department to no avail, and I have discussed
the model with teachers and they said the model setting is ok. Since I am
really a rookie in programming mle problem using stata, any advice will be
useful. My do file is shown below:
*estimate the parameter with mle
set more off
capture program drop myprog_patent
program define myprog_patent
version 12.0
args lnf mu sigma d
*d stands for the depreciation rate
tempvar lnzt lnzt1
* termiyear means the expired year of the patent
quietly gen double
`lnzt'=ln(ct)-ln(1-exp(-(`d'+0.1)))-(`d'*\$ML_y1)-ln(`d'+0.1)
quietly gen double
`lnzt1'=ln(ct1)-ln(1-exp(-(`d'+0.1)))-(`d'*((\$ML_y1)-1))-ln(`d'+0.1)
* this means that the patent is expired but not renewed full term
quietly replace `lnf' = ln(normal((`lnzt'-`mu')/`sigma')) if termiyear!=. &
\$ML_y1==0
quietly replace `lnf'
=ln(normal((`lnzt'-`mu')/`sigma')-normal((`lnzt1'-`mu')/`sigma')) if
termiyear!=. & t2==1
* this means that the patent is expired and renewed full term

quietly replace `lnf' = ln(normal(-(`lnzt'-`mu')/`sigma')) if
appliyear<1994 & \$ML_y1==15
* this means that the patent is not expired
quietly replace `lnf' = ln(normal(-(`lnzt'-`mu')/`sigma')) if termiyear==.
end
* t stands for termiyear - applyear if the patent is expired or 2011 -
applyear if the patent is still renewed
ml model lf myprog_patent (mu: t = ) /sigma /d
ml check
ml init mu=10.3948 sigma=4.3920 dep=0.2601
ml search
ml maximize
end
Here is the results of the do file:
. ml model lf myprog_patent (mu: t = ) /sigma /d.

ml check
Test 1:  Calling myprog_patent to check if it computes log likelihood and
does not alter coefficient vector...
Passed.
Test 2:  Calling myprog_patent again to check if the same log likelihood
value
is returned...
Passed.
The initial values are not feasible.  This may be because the initial values
have been chosen poorly or because there is an error in myprog_patent and it
always returns missing no matter what the parameter values.
Stata is going to search for a feasible set of initial values.
If myprog_patent is broken, this will not work and you will have to press
Break to stop the search.
Searching
initial:       log likelihood =     -<inf>  (could not be evaluated)
searching for feasible values
could not find feasible values
r(491);
end of do-file
r(491);
Could you give me some advice on how to fix this problem, does this
mean I have something wrong with my data set, or it is my function setting
which is wrong, or some other things that I just haven't come up with.
Many regards.

Jason Lee
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```