Statalist


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

Re: st: Return code 199 after redoing the example in stata reference


From   Eva Poen <[email protected]>
To   [email protected]
Subject   Re: st: Return code 199 after redoing the example in stata reference
Date   Sun, 15 Mar 2009 00:53:03 +0000

Jingjing,

your program is fine, apart from some typos.

>        syntax varlist(min=8 max=8) if, at(name)

should read

syntax varlist(min=8 max=8) [if], at(name)

>        sca1ar `a1'=`at'[1,1]

should read

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

(and the same in all lines with sca1ar instead of scalar)

>        sca1ar `gel'=`g14'

should read

scalar `g41'=`g14'

(or so I guess).


>                forva1ues i=1/4 {
>                        forva1ues j = 1/4 {

should read

                forvalues i=1/4 {
                        forvalues j = 1/4 {


In here:

>                replace `w1' = ///
> `a1'+`g11'*`lnp1'+`g12*`lnp2'+`g13'*`lnp3'+`g14'*`lnp4'+`b1'*(`lnm'-`lnpindex')

it should read `g12'*`lnp2' (note the closing single quote after 2).
The same is true for the three lines after this one.

With these corrections, the -nlsur- command ought to run as intended.
By the way, the names that you give to temporary variables in a
program (e.g. lnm, to which you refer to with `lnm' in the program)
have nothing to do with the variable names in the data set. You can
name your temporary variables anything you want (within Stata's rules
for tempvars), but make sure you know which one is which when you call
your program with -nlsur-.

Hope this helps,
Eva





2009/3/14  <[email protected]>:
> Hi,
>
> Since my own codes don't work, I copyed the codes from Stata reference I-p,
> page471, example 5.
>
> I use the same codes, same data set. I only modified two things. First, I
> changed -version 10- to -version 10.1-, which is the version I am using.
> Second, I rename lnexp to lnm in the data set, because the variable is named
> lnm in their program codes. I am quite sure the other codes are exactly the
> same as the one in the book.
>
> However, when I typed the conmand in the last line, -nlsur- bla bla, there
> the error:
>
> nlsuraids returned 199
> verify that nlsuraidss is a function evaluator program
> r(199);
>
>
> That's so wireld! I list my code following:
>
>
>
> program nlsuraids
>
>        version 10.1
>
>        syntax varlist(min=8 max=8) if, at(name)
>
>        tokenize `varlist'
>        args w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnm
>
>        tempname a1 a2 a3 a4
>        sca1ar `a1'=`at'[1,1]
>        sca1ar `a2'=`at'[1,2]
>        sca1ar `a3'=`at'[1,3]
>        sca1ar `a4'= 1-`a1'-`a2'-`a3'
>
>        tempname b1 b2 b3
>        sca1ar `b1'=`at'[1,4]
>        sca1ar `b2'=`at'[1,5]
>        sca1ar `b3'=`at'[1,6]
>
>
>        tempname g11 g12 g13 g14
>        tempname g21 g22 g23 g24
>        tempname g31 g32 g33 g34
>        tempname g41 g42 g43 g44
>        sca1ar `g11'=`at'[1,7]
>        sca1ar `g12'=`at'[1,8]
>        sca1ar `g13'=`at'[1,9]
>        sca1ar `g14'=-`g11'-`g12'-`g13'
>
>        sca1ar `g21'=`g12'
>        sca1ar `g22'=`at'[1,10]
>        sca1ar `g23'=`at'[1,11]
>        sca1ar `g24'=-`g21'-`g22'-`g23'
>
>        sca1ar `g31'=`g13'
>        sca1ar `g32'=`g23'
>        sca1ar `g33'=`at'[1,12]
>        sca1ar `g34'=-`g31'-`g32'-`g33'
>
>        sca1ar `gel'=`g14'
>        sca1ar `g42'=`g24'
>        sca1ar `g43'=`g34'
>        sca1ar `g44'=-`g41'-`g42'-`g43'
>
>
>        quietly {
>                tempvar lnpindex
>                gen double `lnpindex' =
> 5+`a1'*`lnp1'+`a2'*`lnp2'+`a3'*`lnp3'+`a4'*`lnp4'
>                forva1ues i=1/4 {
>                        forva1ues j = 1/4 {
>                                replace
> `lnpindex'=`lnpindex'+0.5*`g`i'`j''*`lnp`i''*`lnp`j''
>                        }
>                }
>
>                replace `w1' =
> `a1'+`g11'*`lnp1'+`g12*`lnp2'+`g13'*`lnp3'+`g14'*`lnp4'+`b1'*(`lnm'-`lnpindex')
>
>                replace `w2' =
> `a2'+`g21'*`lnp1'+`g22*`lnp2'+`g23'*`lnp3'+`g24'*`lnp4'+`b2'*(`lnm'-`lnpindex')
>
>
>                replace `w3' =
> `a3'+`g31'*`lnp1'+`g32*`lnp2'+`g33'*`lnp3'+`g34'*`lnp4'+`b3'*(`lnm'-`lnpindex')
>
>
>
>        }
>
> end
>
> nlsur aids @ w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnm, parameters (a1 a2 a3 b1 b2 b3
> g11 g12 g13 g22 g32 g33) neq(3) ifgnls
>
>
>
> Jingjing
>
>
> 引用 Kit Baum <[email protected]>:
>
>> <>
>> According to help nlsur what you have typed below is not the proper
>> format of the command.
>>
>>
>>        nlsur func_prog @ depvar_1 depvar_2 ...  [varlist] [if] [in]
>> [weight] , nequations(#)
>>                       {parameters(namelist)|nparameters(#)} [options]
>>
>> so you should list the depvars for the several (4?) equations, then
>> give a varlist of variables to be passed to the routine, then comma,
>> nequations() option. In what you have written below you have a ) where
>> you should not and are missing the comma. Also, either parameters() or
>> nparameters() MUST be given.
>>
>> Look at the examples at the foot of the help file for the simpler
>> example of a function evaluator program, and make sure your command
>> follows the appropriate syntax.
>>
>> Kit Baum   |   Boston College Economics and DIW Berlin   |
>> http://ideas.repec.org/e/pba1.html
>> An Introduction to Stata Programming   |
>> http://www.stata-press.com/books/isp.html
>> An Introduction to Modern Econometrics Using Stata   |
>> http://www.stata-press.com/books/imeus.html
>>
>>
>>
>> On Mar 14, 2009, at 02:33 ,Jingling wrote:
>>
>>>
>>> nlsur wellll @ lnc sl sk sm lnpl lnpk lnpm lnpe lnq halflnqlnq lnpllnq
>>> lnpklnq lnpmlnq lnpelnq lnqt lnqd1 lnqd2 lnqd3 lnqd4 lnqd5 lnqd6 t
>>> halftt lnplt lnpkt lnpmt lnpet d1 d2 d3 d4 d5 d6 td1 td2 td3 td4 td5
>>> td6 lnpld1 lnpld2 lnpld3 lnpld4 lnpld5 lnpld6 lnpkd1 lnpkd2 lnpkd3
>>> lnpkd4 lnpkd5 lnpkd6 lnpmd1 lnpmd2 lnpmd3 lnpmd4 lnpmd5 lnpmd6 lnped1
>>> lnped2 lnped3 lnped4 lnped5 lnped6, parameters(al ak am aq aqq blq bkq
>>> bmq bqt bq1 bq2 bq3 bq4 bq5 bq6 at att blt bkt bmt d1 d2 d3 d4 d5 d6
>>> bt1 bt2 bt3 bt4 bt5 bt6 bl1 bl2 bl3 bl4 bl5 bl6 bk1 bk2 bk3 bk4 bk5
>>> bk6  bm1 bm2 bm3 bm4 bm5 bm6 be1 be2 be3 be4 be5 dkl dkk dml dmk dmm)
>>> neq(4) ifgnls

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index