Statalist The Stata Listserver


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

st: maximum likelihood estimation unknown function error


From   "Marcelo Cadena" <[email protected]>
To   [email protected]
Subject   st: maximum likelihood estimation unknown function error
Date   Tue, 22 Aug 2006 11:52:11 +0200

I am trying to maximize the following likelihood function implemented in my do-file below. In my opinion the structure of the program corresponds to the one given in the book of Gould and Sribney, "Maximum likelihood estimation with Stata". However, when checking the code, stata returns the error message given at the bottom.
The variables in sample1 are named ML_y1 to ML_y5. I would be grateful if somebody can find the error in my code




. program define itrader
1. version 6
2. args lnf theta1 theta2 theta3 theta4
3.
. tempvar w q v
4. quietly gen double `w' = exp(ln(1-`theta1')-2*`theta3'*$ML_y3 + ($ML_y1 + $ML_y2)*ln(`theta3'*$ML_y3) -

 $ML_y4 - $ML_y5)
5. quietly gen double `q' = exp(ln(`theta1'*`theta2') - 2*`theta3'*$ML_y3 - `theta4'*$ML_y3 + $ML_y1*ln(`th

eta3'*$ML_y3) + $ML_y2*ln((`theta4' + `theta3')*$ML_y3)- $ML_y4 - $ML_y5)
6. quietly gen double `v' = exp(ln(`theta1'*(1-`theta2')) - 2*`theta4'*$ML_y3 - `theta3'*$ML_y3 + $ML_y1*ln

((`theta4' + `theta3')*$ML_y3) + $ML_y2*ln(`theta3'*$ML_y3)- $ML_y4 - $ML_y5)
7.
. quietly replace `lnf' = `w' + `q' + `v'
8. end

. . use "C:\DOKUME~1\JUANMA~1\EIGENE~1\prog\MATHEP~1\Stata8se\sample1.dta"

. ml model lf itrader () () () ()

. end of do-file

. ml check

Test 1: Calling itrader to check if it computes log likelihood and
does not alter coefficient vector...
FAILED; itrader returned error 133.

Here is a trace of its execution:
------------------------------------------------------------------------------
-> itrader __000009 __000005 __000006 __000007 __000008
- `begin'
= capture noisily version 8: itrader __000009 __000005 __000006 __000007 __000008
----------------------------------------------------------------------------------- begin itrader ---
- version 6
- args lnf theta1 theta2 theta3 theta4
- tempvar w q v
- quietly gen double `w' = exp(ln(1-`theta1')-2*`theta3'*$ML_y3 + ($ML_y1 + $ML_y2)*ln(`theta3'*$ML_y

3) - $ML_y4 - $ML_y5)
= quietly gen double __00000A = exp(ln(1-__000005)-2*__000007* + ( + )*ln(__000007*) - - )

Unknown function +()

------------------------------------------------------------------------------------- end itrader ---
- `end'
= set trace off
------------------------------------------------------------------------------
Fix itrader.
r(133);
*
* 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/




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