Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: nlsuraids returned 199, please help


From   "Brian P. Poi" <[email protected]>
To   [email protected]
Subject   Re: st: nlsuraids returned 199, please help
Date   Fri, 06 May 2011 20:55:38 -0400


On 05/06/2011 08:12 AM, ABDULFATAH S, ADAM wrote:
Dear Statalist,
I will be very grateful if someone can assist me with this.
I am having a difficult time estimating AIDS model with 11 expenditure equations using stata's nlsur.
Stata is returning this error:

nlsuraids returned 199
verify that nlsuraids is a function evaluator program
r(199);

I have checked my code again and again and it seems to me there is no error, or may be I am missing something.
Any assistance is highly appreciated.

Here is my code:

program nlsuraids
	version 10.0
	syntax varlist (min=24 max=24) if, at(name)
	tokenize `varlist'
	args w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 lnp1 lnp2 lnp3
	lnp4 lnp5 lnp6 lnp7 lnp8 lnp9 lnp10 lnp11 lnp12 lnexp

Here you are missing a line-continuation mark after lnp3, so Stata is trying to interpret lnp4 as a command. Try this instead:

 	args w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 lnp1 lnp2 lnp3  ///
   	   lnp4 lnp5 lnp6 lnp7 lnp8 lnp9 lnp10 lnp11 lnp12 lnexp

	tempname g61 g62 g63 g64 g65 g66 g67 g68 g69 g610 g611 g612
	tempname g71 g72 g73 g74 g75 g76 g77 g78 g79 g710 g711 g612

You've got g612 twice.  The end of the second line should be g712.

		tempvar lnpindex
			gen double `lnpindex' = 5 + `a1'*`lnp1'+`a2'*`lnp2'+`a3'*`lnp3'+`a4'*`lnp4'+`a5'*`lnp5'+ ///
		`a6'*`lnp6'+`a7'*`lnp7'+`a8'*`lnp8'+`a9'*`lnp9'+`a10'*`lnp10'+`a11'*`lnp11'+`a12'*`lnp12'

		forvalues i = 1/12 {
			forvalues j = 1/12 {
				replace `lpindex' = `lpindex'+ ///
					0.5*`g`i'`j''*`lnp`i''*`lnp`j''
			}
		  }

You -generate- the tempvar `lnpindex', yet in your loops you refer to `lpindex'. Change `lpindex' to `lnpindex'.

		  replace `w1' = `a1' + `g11'*`lnp1' + `g12'*`lnp2' + `g13'*`lnp3' +   ///
		  		`g14'*`lnp4' + `g15'*`lnp5'+ `g16'*`lnp6'+ `g17'*`lnp7' + ///
		  		`g18'*`lnp8' + `g19'*`lnp9'+ `g110'*`lnp10'+ `g111'*`lnp11' ///
		  		`g112'*`lnp12'+ `b1'*(`lnexp'-`lnpindex')

You are missing a plus sign at the end of the third line, between the `g111'*`lnp11' term and the `g112'*`lnp12' term. That is also true for all the -replace- statements for `w2', `w3', ...

   -- Brian Poi
   -- [email protected]
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index