[Limdep Nlogit List] subfunctions

William Greene wgreene at stern.nyu.edu
Thu Nov 22 03:40:55 EST 2007


Bob.  Two problems with the command: 
(1) Don't repeat function
names on the LHS. You can only define P1 once. 
| P1   = sew/(se*se)*(hearn-bx)+gz
(2) the one that
caused the ticket: The If(statement) is not supported in that
construction.  You are trying to bound the results of the prior
computations to prevent the program from taking the log of zero,
which makes sense.  I do not believe the compiler for MAXIMIZE
supports a Min or Max function (looks like maybe it should), 
but I think you can get the result you need without doing too
much damage to the function by using log(PhiA+.00001) and
Log(1.000001 - PhiA) and log(ge+.000001) or something like that.
It might be worth experimenting along these lines - trying it
first without any correction - to see how it performs.
This is a problem that comes up sometimes, and seems to be worth
looking into.
Cheers,
Bill Greene

----- Original Message -----
From: "Robert Nakosteen" <nakosteen at som.umass.edu>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Wednesday, November 21, 2007 11:16:53 AM (GMT-0500) Auto-Detected
Subject: [Limdep Nlogit List] subfunctions

Greetings all,
The following subfunction is followed by an error message, also included:
maximize; fcn = bx   = b0 + b1*hage + b2*heduc
    | gz   = g0 + g1*wearn + g2*child + g3*unem
    | P1   = sew/(se*se)
    | P1   = P1*(hearn-bx)
    | P1   = gz + P1
    | P2   = 1 - (sew*sew)/(se*se)
    | P3   = sqr(P2)
    | PhiA = Phi(P1/P3)
    | ge   = (N01((hearn - bx)/se))/se
    | if(PhiA<0.001) PhiA=0.001
    | if (PhiA>0.999) PhiA=0.999
    | if(ge<0.001) ge=0.001
    | L1   = log(PhiA)
    | L2   = log(1-PhiA)
    | L3   = log(ge)
    | dummy*(L1 + L3) + (1-dummy)*(L2 + L3);
    labels = b0,b1,b2,g0,g1,g2,g3,se,sew;
    start =  43.6,-0.25,8.07,1.35,0.01,-0.34,0.01,20,0.10$
Error:   572: Expected subfunction name to appear in FCN=....
--> Stop$
Does anyone know the cure for this error?
Thanks in advance.
Robert A. Nakosteen
Professor
Isenberg School of Management
University of Massachusetts/Amherst
Amherst, MA  01003
Telephone:  413-545-5687
FAX: 413-545-3858
 Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au


-- 
Professor William Greene
Department of Economics
Stern School of Business
New York University
44 West 4th St., Rm. 7-78
New York, NY   10012
http://www.stern.nyu.edu/~wgreene



More information about the Limdep mailing list