Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Inequaltity constraints

From   Stas Kolenikov <>
Subject   Re: st: RE: Inequaltity constraints
Date   Thu, 19 Jan 2006 10:38:30 -0600

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' = .
   else {
      * substantial code

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 <> wrote:
> Mindaugas Baltutis wrote:
>  Is it possible to define inequality constraints for parameters when
> performing maximum likelihood estimation in STATA?

Stas Kolenikov

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index