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

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

 From Yonas Alem <[email protected]> To [email protected] Subject Re: st: RE: nlsur command for a six commodity demand system Date Mon, 3 Jan 2011 06:58:16 -0800 (PST)

Thanks a lot Brian! It worked when I removed the space in the scalar statement.
Yonas  ____________________________

----- Original Message ----
From: Brian P. Poi <[email protected]>
To: [email protected]; [email protected]
Sent: Mon, January 3, 2011 3:05:24 AM
Subject: st: RE: nlsur command for a six commodity demand system

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?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/

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