One thing that strikes me is that you haven't specified a dependent
variable.
Other than that I would split up the likelihood in smaller parts, with
a bunch of -tempvars- (-doubles- of course), like so:
tempvar part1 part2 part3 part4 part5
gen double `part1' = (((`m')*(`g')+(`mu')*(`e')*(`eh')*(`p'))^bo)
gen double `part2' = (((`m')*(`mg')+(`mu')*(`e')*(`eh')*(`mp'))^bq)
gen double `part3' = (((`mu')*(`e')*(`eh')*(`p'))^so)
gen double `part4' = (((`mu')*(`e')*(`eh')*(`mp'))^sq)
gen double `part5' = (((`mu')*(`me'))^n))
etc
replace `lnf' = ln((`a')*(`d')* \\\
`part1'*`part2'*`part3'*`part4'*`part5'+...)
I would change part1 part2 etc in more substantively meaningful names.
For example, I often create temprorary variables called num and denom
(for the numerator and the denominator of a fraction). This does not
change your likelihood, but it makes the code easier to read and debug.
The third bit of advise I can give you is to start debugging a very
much simplified version of your likelihood. Often when you restrict
parameters of these likelihoods to certain values, the model collapses
to a much simpler special cases (for which a official Stata command may
exist). Debug your program for such a special case (and check against
the result from the official Stata equivalent if it exists), and than
add one by one the additional parameters to your model.
Hope this helps,
Maarten
--- Katia Bobulova <[email protected]> wrote:
> Dear all,
>
> I am trying to perform a maximum likelihood that it is a little bit
> complicate for me.
> I specified the model and after that I used the command ml check to
> control that everything was fine, but I received the message that
> there are too few variables specified.
>
> Could you please help me to understand what is wrong with my model? I
> really need help!
>
> Following my program:
>
> program define myprogram
> version 10.0
> args lnf a d m e g p
>
> tempvar eh mu ma me md mg mp
>
> quietly gen double `eh'=0.7*`e'
> quietly gen double `mu'=1-`m'
> quietly gen double `ma'=1-`a'
> quietly gen double `me'=1-`e'
> quietly gen double `md'=1-`d'
> quietly gen double `mg'=1-`g'
> quietly gen double `mp'=1-`p'
>
> quietly replace
>
`lnf'=ln((`a')*(`d')*((((`m')*(`g')+(`mu')*(`e')*(`eh')*(`p'))^bo)*(((`m')*(`mg')+(`mu')*(`e')*(`eh')*(`mp'))^bq)*(((`mu')*(`e')*(`eh')*(`p'))^so)*(((`mu')*(`e')*(`eh')*(`mp'))^sq)*(((`mu')*(`me'))^n))+(`a')*(`md')*((((`mu')*(`e')*(`eh')*(`p'))^bo)*(((`mu')*(`e')*(`eh')*(`mp'))^bq)*(((`m')*(`g')+(`mu')*(`e')*(`eh')*(`p'))^so)*(((`m')*(`mg')+(`mu')*(`e')*(`eh')*(`mp'))^sq)*(((`mu')*(`me'))^n))+(`ma')*((((`e')*(`eh')*(`p'))^bo)*(((`e')*(`eh')*(`mp'))^bq)*(((`e')*(`eh')*(`p'))^so)*(((`e')*(`eh')*(`mp'))^sq)*((`me')^n))
>
> end
>
> ml model lf myprogram (a:) (d:) (m:) (e:) (g:) (p:)
> ml check
>
> After this I receive the error message.
>
> Thank you very much for you time.
>
> Katia
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/