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

# st: RE: nlsur command for a six commodity demand system

 From "Brian P. Poi" <[email protected]> To <[email protected]> To [email protected] Subject st: RE: nlsur command for a six commodity demand system Date Sun, 2 Jan 2011 21:05:24 -0500

```Dear Stata Users,
I'm trying to estimate a quadratic demand system of six equations but the
function evaluator program I wrote is not working.  When I try to run
the nlsur regression, Stata generates an error message (nlsuryonquaid
returned 109-verify that nlsuryonquaid is a function evaluator program).

Below is the function evaluator program I wrote and I would appreciate it
very much if somone can help me figure out what the problem is.
Thanks,
Yonas

program nlsuryonquaid
version 11
syntax varlist(min=12 max=12) if, at(name)
tokenize `varlist'
args w1 w2 w3 w4 w5 lnp1 lnp2 lnp3 lnp4 lnp5 lnp6 lnexp
tempname a1 a2 a3 a4 a5 a6
scalar `a1' = `at' [1,1]
scalar `a2' = `at' [1,2]
scalar `a3' = `at' [1,3]
scalar `a4' = `at' [1,4]
scalar `a5' = `at' [1,5]

...

--------------------------

The space between the matrix name and the left bracket in your scalar
definitions could be the source of the r(109) errors.  When subscripting a
matrix, you can't have a space between the name and the subscript:

. mat b = (1,2,3)

. sca a = b [1,3]
type mismatch
r(109);

I'd try removing the spaces between `at' and the left bracket in all your
-scalar- statements.  IE, write

scalar `a1' = `at'[1,1]

scalar `a1' = `at' [1,1]		// sic, not valid

-- 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/
```