Am 16.03.2017 um 08:39 schrieb Riccardo (Jack) Lucchetti:
On Thu, 16 Mar 2017, Alecos Papadopoulos wrote:
> In mle estimation, we can constrain the permissible space for the
> parameters under estimation like this:
>
> mle logl = check ? p*ln(ax) - lngamma(p) - ln(x) - ax : NA
> series ax = alpha*x
> scalar check = (alpha>0) && (p>0)
> params alpha p
> end mle
>
> Do we use the same syntax when using nls, non-linear least-squares?
> The general difference in syntax that I can see, is that in mle we
> define directly the function that is to be maximized, while in nls we
> define the regression function... so maybe the syntax for the
> constraint should be different?
I'd say the standard trick is to map the parameter to the admissible
range with an appropriate function (usually exp, log, or a cdf). So here
using exp(alpha2) instead of alpha, for example, which is guaranteed to
be positive. Of course a little more work then has to be done at the end
to back out the right confidence interval.
NLS is a special case of MLE. All you have to do is define a
nonlinear
function for the mean and plug it into a normal density.
As usually Jack provides the deeper insight, but by that logic we
wouldn't need the NLS command in gretl...
cheers,
sven