Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | David Ashcraft <ashcraftd@rocketmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Nonlinear regression syntax |
Date | Sat, 19 Jan 2013 04:39:09 -0800 (PST) |
rg, algebraic expression and gfc are parameters to be estimated and that's why I used braces {}. gamma and ci are constants. in the first line: rg and moveave are variables where moveave is the quarterly moving average of rg. You mentioned that a brace is omitted. I do not see the omitted brace. Can you please point out the missing brace in the following? nl (rx={rg}+{rg*(1+exp(-gamma*(moveave-ci)))^-1}+{gfc}) Regards David ----- Original Message ----- From: Nick Cox <njcoxstata@gmail.com> To: statalist@hsphsun2.harvard.edu Cc: Sent: Saturday, January 19, 2013 2:59:01 PM Subject: Re: st: Nonlinear regression syntax Did you type _exactly_ the first line? If "rg" is a parameter to be estimated, then a brace "}" has been omitted. Is "gamma" really a variable as implied by your syntax? In general, there seems confusion here over algebraic conventions and Stata rules. In algebra you can use braces { } using similar rules to parentheses () and brackets []: i.e. they are all delimiters and must just match and nest logically. But in -nl- expressions braces {} have a special meaning to indicate parameters to be estimated and makes no sense otherwise. Nick On Sat, Jan 19, 2013 at 11:12 AM, David Ashcraft <ashcraftd@rocketmail.com> wrote: > I want to run the following model as a non-linear regression: > > nl (rx={rg}+{rg*(1+exp(-gamma*(moveave-ci)))^-1}+{gfc}) > > where rx is dependent variable. when I run this model Stata gives the error code: r(480); starting values invalid or some RHS variables have missing values > > > As a second option, I solved the non-linear function outside the equation by having a new variable fm={rg*(1+exp(-gamma*(moveave-ci)))^-1} and run again: > > nl (rx={rg}+{fm}+{gfc}) > > Now I get the results with omitted values for fm. > > I don't know where is my mistake. Any help will be greatly appreciated. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/