Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -nl- error message


From   Robert Duval <[email protected]>
To   [email protected]
Subject   Re: st: -nl- error message
Date   Sat, 6 Aug 2005 14:59:52 -0400

another tip is to debug your code by using set trace on... it usually works well

On 8/6/05, Robert Duval <[email protected]> wrote:
> This might be a long shot (and maybe irrelevant to your problem), but
> I see you have long equations and at least the way they appear on the
> email they seem to be on several lines...
> 
> if you break a command by lines you need a "#delimit ;" statement, and
> a " ; " at the end of each command.
> 
> if you have each command on a single line, then ignore this message,
> as the source of your syntax error will be somewhere else
> 
> robert
> 
> On 8/5/05, Terra Curtis <[email protected]> wrote:
> >
> >
> > I am running a nonlinear regression and have written the program which
> > specifies the equation:
> >
> > program nlalpha_effects
> >
> > version 8.1
> >
> > if "`1'" == "?" {
> >
> > global S_1 "BO B1 AM0 AM1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 B2 AR0 AR1 AR2 AR3
> > AR4 AR5 AR6 AR7 AR8 AR9"
> >
> > global B0=1
> >
> > global B1=1
> >
> > global AM0=1
> >
> > global AM1=1
> >
> > global AM2=1
> >
> > global AM3=1
> >
> > global AM4=1
> >
> > global AM5=1
> >
> > global AM6=1
> >
> > global AM7=1
> >
> > global AM8=1
> >
> > global AM9=1
> >
> > global B2=1
> >
> > global AR0=1
> >
> > global AR1=1
> >
> > global AR2=1
> >
> > global AR3=1
> >
> > global AR4=1
> >
> > global AR5=1
> >
> > global AR6=1
> >
> > global AR7=1
> >
> > global AR8=1
> >
> > global AR9=1
> >
> > exit
> >
> > }
> >
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T]) + $B2*($AR0*ireal46[T]) if
> > T==1
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1]) +
> > $B2*($AR0*ireal46[T] + $AR1*ireal46[T-1]) if T==2
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2]) + $B2*($AR0*ireal46[T] + $AR1*ireal46[T-1] +
> > $AR2*ireal46[T-2]) if T==3
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3]) + $B2*($AR0*ireal46[T] +
> > $AR1*ireal46[T-1] + $AR2*ireal46[T-2] + $AR3*ireal46[T-3]) if T==4
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4]) + $B2*($AR0*ireal46[T]
> > + $AR1*ireal46[T-1] + $AR2*ireal46[T-2] + $AR3*ireal46[T-3] +
> > $AR4*ireal46[T-4]) if T==5 by coname: replace `1'=$B0+$B1*($AM0*imktg[T] +
> > $AM1*imktg[T-1] + $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4] +
> > $AM5*imktg[T-5]) + $B2*($AR0*ireal46[T] + $AR1*ireal46[T-1] +
> > $AR2*ireal46[T-2] + $AR3*ireal46[T-3] + $AR4*ireal46[T-4] +
> > $AR5*ireal46[T-5]) if T==6
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4] + $AM5*imktg[T-5] +
> > $AM6*imktg[T-6]) + $B2*($AR0*ireal46[T] + $AR1*ireal46[T-1] +
> > $AR2*ireal46[T-2] + $AR3*ireal46[T-3] + $AR4*ireal46[T-4] +
> > $AR5*ireal46[T-5] + $AR6*ireal46[T-6]) if T==7
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4] + $AM5*imktg[T-5] +
> > $AM6*imktg[T-6] + $AM7*imktg[T-7]) + $B2*($AR0*ireal46[T] +
> > $AR1*ireal46[T-1] + $AR2*ireal46[T-2] + $AR3*ireal46[T-3] +
> > $AR4*ireal46[T-4] + $AR5*ireal46[T-5] + $AR6*ireal46[T-6] +
> > $AR7*ireal46[T-7]) if T==8
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4] + $AM5*imktg[T-5] +
> > $AM6*imktg[T-6] + $AM7*imktg[T-7] + $AM8*imktg[T-8]) + $B2*($AR0*ireal46[T]
> > + $AR1*ireal46[T-1] + $AR2*ireal46[T-2] + $AR3*ireal46[T-3] +
> > $AR4*ireal46[T-4] + $AR5*ireal46[T-5] + $AR6*ireal46[T-6] +
> > $AR7*ireal46[T-7] + $AR8*ireal46[T-8]) if T==9
> > by coname: replace `1'=$B0+$B1*($AM0*imktg[T] + $AM1*imktg[T-1] +
> > $AM2*imktg[T-2] + $AM3*imktg[T-3] + $AM4*imktg[T-4] + $AM5*imktg[T-5] +
> > $AM6*imktg[T-6] + $AM7*imktg[T-7] + $AM8*imktg[T-8] + $AM9*imktg[T-9]) +
> > $B2*($AR0*ireal46[T] + $AR1*ireal46[T-1] + $AR2*ireal46[T-2] +
> > $AR3*ireal46[T-3] + $AR4*ireal46[T-4] + $AR5*ireal46[T-5] +
> > $AR6*ireal46[T-6] + $AR7*ireal46[T-7] + $AR8*ireal46[T-8] +
> > $AR9*ireal46[T-9]) if T>=10
> > end
> >
> > It is an equation in sigma notation for 10 periods. The nl command line I
> > have written is this:
> >
> > nl alpha_effects real172, variables(imktg ireal46) parameters(B0 B1 AM0 AM1
> > AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 B2 AR0 AR1 AR2 AR3 AR4 AR5 AR6 AR7 AR8 AR9)
> > nparameters(23)
> >
> > where real172 is the dependent variable. When I run this section of code, I
> > get a syntax error but strangely it occurs after the first iteration:
> >
> > nl alpha_effects real172, variables(imktg ireal46) parameters(B0 B1 AM0 AM1
> > AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 B2 AR0 AR1 AR2 AR3 AR4 AR5 AR6 AR7 AR8 AR9)
> > nparameters(23) (obs = 3200)
> >
> > Iteration 0: invalid syntax
> >
> > r(198);
> >
> > end of do-file
> >
> > r(198);
> >
> > Any ideas as to how this error might be occuring? It seems the syntax of the
> > program and nl command is correct, since Stata "knows" to start the
> > iteration process. I just have no idea where a syntax error could be if it's
> > not actually in my program or nl command line.
> >
> > Thanks for any help.
> >
> > Terra Curtis
> >
> >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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