Dear Statalist,
I posted a couple of weeks ago a message about fitting an Emax model (non
linear) with
several data from each subject. I was answered that the cluster option is
not allowed with the nl command and I should use ml command.
I am new to ml command and I am in trouble to fit a very simple non linear
equation :
y = x^theta
I have simulated a data set of 100 observations:
set obs 100
gen x=-n
gen y=x^3+10*invnorm(uniform())
Here is my do file :
capture program drop myproc
program define myproc
version 7.0
args lnf theta1 theta2
quietly replace
`lnf'=ln(normd((y-x^`theta1')/`theta2'))-ln(`theta2')
end
ml model lf myproc (y,nocons ) /beta1 /sigma
ml search
ml maximize, difficult
I get the following output :
. do essaiml
. capture program drop myproc
. program define myproc
1. version 7.0
2. args lnf theta1 theta2
3. quietly replace
`lnf'=ln(normd((y-x^`theta1')/`theta2'))-ln(`theta2')
4.
. end
. ml model lf myproc (y,nocons ) /beta1 /sigma
. ml search
initial: log likelihood = -<inf> (could not be evaluated)
could not find feasible values
r(491);
end of do-file
r(491);
Can somebody tell me what's wrong with my procedure.
Sincerely,
Xavier
*
* 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/