A trick you can do, but you would need to write your own likelihood
code for that, is to set the likelihood to missing value when the
parameters are out of range. Say you want to have a parameter a>=0.
Then your code in the program that computes likelihood for method -lf-
may read something like
program define mycrazyll
version 9.1
args lnf theta a
if `a'<0 {
qui replace `lnf' = .
exit
}
else {
* substantial code
}
end
In that case, however, -ml-'s optimizer breaks down as it cannot
compute derivatives near the boundary. If say 0 is in fact the MLE,
then during optimization -ml- will come around zero, and find itself
stepping around it, hence getting some missing values, and you'll see
warning and error messages like "missing values encountered", or
"cannot compute derivatives", etc. It may stop, or at best set the
standard error for a to a missing.
If that situation were to happen quite often in user-written
likelihoods, I would suggest a -boundary- option for -ml maximize-,
may be showing which parameters may be at a boundary, so that those
missing values would not take -ml- by surprise, and it could switch to
a one-sided approximations for derivaties, rather than centered
derivatives. How does that sound for Stata Corp.?
On 1/17/06, Maarten Buis <[email protected]> wrote:
> Mindaugas Baltutis wrote:
> Is it possible to define inequality constraints for parameters when
> performing maximum likelihood estimation in STATA?
--
Stas Kolenikov
http://stas.kolenikov.name
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/