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

From |
Eva Poen <eva.poen@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Return r(111) this time |

Date |
Mon, 16 Mar 2009 08:45:01 +0000 |

Almost there. Lose the quotes, and call your program directly. nlsurwellbehav copy_lnc copy_sl copy_sk copy_sm lnpl lnpk lnpm lnpe lnq t d1 d2 d3 d4 d5 d6, at (a) Eva 2009/3/15 <jjc.li@utoronto.ca>: > Thank you Eva for not giving me up. I typed > > > matrix a = J(1,62,0) > > gen copy_lnc = lnc > > gen copy_sl = sl > > gen copy_sm = sm > > gen copy_se = se > > set trace on > > nlsur wellbehav "copy_lnc copy_sl copy_sk copy_sm' "lnpl lnpk lnpm lnpe lnq > t d1 d2 d3 d4 d5 d6", at (a) > > Is it right? Here's the return: > > ------------------------------------------------------------- end > _on_colon_parse --- > - local ZERO `"`s(before)'"' > = local ZERO `"nlsur, jkopts(eclass) noeqlist"' > - local 0 `"`s(after)'"' > = local 0 `" wellbehav "copy_lnc copy_sl copy_sk copy_sm' "lnpl lnpk lnpm > lnpe lnq t d1 >> >> d2 d3 d4 d5 d6", at (a)"' > > - quietly syntax [anything(equalok)] [if] [in] [fw aw pw iw] [, VCE(string > asis) VCE1(s >> >> tring asis) * ] > > invalid something: quotes do not match > > ----------------------------------------------------------------- end > _vce_parserun --- > --------------------------------------------------------------------------- > end nlsur --- > r(198); > > > > > Quoting Eva Poen <eva.poen@gmail.com>: > >> Jingjing, >> >> As Nick pointed out, you know the names of your own variables. We >> don't. So, when I said "right hand side variables" I meant the list of >> right hand side variables in your equations, in the order that your >> program needs them. Your program reads something like >> >> args lnc sl sk sm lnpl lnpk lnpm lnpe lnq t d1 d2 d3 d4 d5 d6 >> >> , and only you know what these names stand for. All we know is that >> the first four are left hand side variables, and the rest are right >> hand side variables in your equations. >> >> So, besides >> >> matrix a = J(1,62,0) >> >> you need to create copies of your left hand side variables, which you can >> do by >> >> gen copy_var1 = var1 >> >> assuming that var1 is the name of your variable. Do this for all your >> left hand side variables, and then call your program with the list of >> all 16 variables that you need for your equations, in the order >> >> lnc sl sk sm lnpl lnpk lnpm lnpe lnq t d1 d2 d3 d4 d5 d6 >> >> because this is what your program asks for. Just make sure that, >> instead of providing the names of your left hand side variables, you >> provide the names of their _copies_. -set trace on- and see what >> happens. >> >> >> As a general remark, you might find it useful to attend a NetCourse by >> Statacorp, especially NC151. >> >> >> Eva >> >> >> >> 2009/3/15 <jjc.li@utoronto.ca>: >>> >>> Sorry but could you take a example? >>> >>> >>> >>> Quoting Nick Cox <n.j.cox@durham.ac.uk>: >>> >>>> Eva's text was not meant to be taken literally! >>>> >>>> Your own syntax commits you to supplying 16 variable names and the name >>>> of a matrix in an option. >>>> >>>> Nick >>>> n.j.cox@durham.ac.uk >>>> >>>> jjc.li@utoronto.ca >>>> >>>> Here's the return: >>>> >>>> >>>> . matrix a = J(1,62,0) >>>> >>>> . set trace on >>>> >>>> . >>>> . nlsurwellbehav "copies of dep. variables" "right hand side >>>> variables" , at(a) >>>> ---------------------------------------------------------------- begin >>>> nlsurwellbehav --- >>>> - version 10.1 >>>> - syntax varlist(min=16 max=16) [if], at(name) >>>> time-series operators not allowed >>>> ------------------------------------------------------------------ end >>>> nlsurwellbehav --- >>>> r(101); >>>> >>>> Quoting Eva Poen <eva.poen@gmail.com>: >>>> >>>>> I'm not sure I understand you here. Are you referring to the line >>>>> >>>>>> replace `lnc' = 5+`aq'*`lnq' ... >>>>> >>>>> where there is a hard coded 5 (not a starting value! This is a set >>>>> value.), and did you replace this value of 5 by another parameter, >>>>> e.g. `a0'? In terms of the program, that is not a problem as long as >>>>> you adjust your code. It would be easiest if you put this parameter >>>>> last, since this saves you the pain of changing all your `at'[1,x] >>>>> statements to `at'[1,x+1]. Therefore, my suggestion would be to code >>>>> >>>>> scalar `dmm'=`at'[1,61] >>>>> tempname a0 >>>>> scalar `a0' =`at'[1,62] >>>>> >>>>> >>>>> quietly { >>>>> replace `lnc' = `a0'+ .... >>>>> } >>>>> >>>>> Now, for the debugging, just follow my suggestions earlier, and invoke >>>>> your program directly. You need to create a matrix of initial values, >>>>> e.g. zeros for all coefficients. If you have 62 parameters, you do >>>>> >>>>> matrix a = J(1,62,0) >>>>> >>>>> which gives you a row vector of 62 zeros. Next create copies of all >>>>> your dependent variables, and invoke your program: >>>>> >>>>> set trace on >>>>> nlsurwellbehav "copies of dep. variables" "right hand side variables" >>>>> , >>>>> at(a) >>>>> >>>>> and see where the problem lies. * * 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/

**Follow-Ups**:**st: the command to specify one observation***From:*jjc.li@utoronto.ca

**Re: st: RE: Return r(111) this time***From:*jjc.li@utoronto.ca

**References**:**RE: st: RE: Return r(111) this time***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Return r(111) this time***From:*Eva Poen <eva.poen@gmail.com>

**Re: st: RE: Return r(111) this time***From:*jjc.li@utoronto.ca

**Re: st: RE: Return r(111) this time***From:*Eva Poen <eva.poen@gmail.com>

**Re: st: RE: Return r(111) this time***From:*jjc.li@utoronto.ca

**RE: st: RE: Return r(111) this time***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**RE: st: RE: Return r(111) this time***From:*jjc.li@utoronto.ca

**Re: st: RE: Return r(111) this time***From:*Eva Poen <eva.poen@gmail.com>

**Re: st: RE: Return r(111) this time***From:*jjc.li@utoronto.ca

- Prev by Date:
**RE: st: RE: twoway scatter returns "unmatched quote"** - Next by Date:
**Re: st: Maximum length of a string expression in a program** - Previous by thread:
**Re: st: RE: Return r(111) this time** - Next by thread:
**Re: st: RE: Return r(111) this time** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |