Bookmark and Share

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


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

Re: st: Nonlinear regression syntax


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Nonlinear regression syntax
Date   Sat, 19 Jan 2013 11:59:01 +0000

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index