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

# Re: st: Non-linear model + More parameters than variables + -ml-

 From Aljar Meesters To statalist@hsphsun2.harvard.edu Subject Re: st: Non-linear model + More parameters than variables + -ml- Date Fri, 3 May 2013 18:38:21 +0200

```Dear Miguel,

In an earlier post of you I have suggested to pass your independent
variables as if it was dependent so you could run your program with
minor adjustments. Yet, I also suggested to use non linear least
squares. You replied that you have ran into convergence problems by
using non linear least squares, so I can see why you want to continue
with maximum likelihood (although I suggest that you should check if
the ml estimates give you a global maximum by using different starting
values, since convergence is apparently problematic).
In order to get this model running you can use:

ml model lf datos6mean (theta1:vdmean=) (theta2:vlagmean=) (theta3:)
(theta4:) (sigma:)
ml maximize

basically the idea is that between the () you start with a name of the
parameter than a double dot, the name of a variable that you can
obtain via \$ML_y* and the number of () gives you the number of
parameters that you, in your case, can obtain via `theta1', `theta2',
etc.
This is a bit of a hack and I have suggested it to get you started
with the idea that you would use -nl-. You may want to look at
method-d0, d1, or d2 evaluators, if you want to proceed with using
-ml-, since these are more suited for your problem.
Best,

Aljar

> Hi, Statalisters. I am stuck with a problem. I have been able to solve part
> of it (with your help), but not the following.
> One of the versions of my model is not linear and quite complex. This is it
> (x and y are variables, and thetas are parameters),
>
> y=[theta1+theta2*(x/theta3)^theta4]*[1-(x/theta3)]
>
> To estimate it using -ml- I have used this program (assuming that residuals
> are normally distributed):
>
> program datos6mean
> version 10.1
> args lnf theta1 theta2 theta3 theta4 sigma
> quietly replace `lnf' = ln(normalden(\$ML_y1,
> (`theta1'+`theta2'*(\$ML_y2/`theta3')^`theta4')*(1 - (\$ML_y2/`theta3')),
> `sigma'))
> end
>
> Nevertheless, I do not know how to write the command -ml model lf
> datos6mean- in order to indicate Stata that there are just two variables
> (that I have introduced as if both of them were dependent variables), that
> there is no linear part in the model, but there are four parameters to be
> estimated.
>
> Thanks.
> Miguel.
>
> *
> *   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/
*
*   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/
```