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

Re: st: nonlinear least squares


From   khigbee@stata.com
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: nonlinear least squares
Date   Sat, 29 Jun 2002 12:25:05 -0500

Henrik Andersson <henrik.andersson@tft.lth.se> asks:

> Hi,
> 
> I am having problem using nonlinear least squares. It seems to work when I 
> do the programming, I do not get any "error message" when running the 
> funtion that I have programmed. The problem occure when I try to estimate 
> the function.  I even have used one of the examples from the "reference 
> guide" to see if it was my function that was the problem, but the result is 
> the same, I get an error message. My programming for the example from the 
> book looks like, where x is my dependent varialbe:
> 
> program define nltest
>          version 7.0
>          if "`1" == "?" {
>                  global S_1 "B0 B1"
>                  global B0=1
>                  global B1=.1
>                  exit
>          }
>          replace `1=$B0*(1-exp(-$B1*x))
> end
> 
> I then give the command,
> 
> nl test y
> 
> which produces the error message:
> 
> nltest refused query, rc=198
> r(196);
> 
> Under r(196) one can read, "Your nlfunc program did not work properly with 
> the nl command."
> 
> What do I do wrong?

Your right single quote mark is incorrect.  I don't know much
about the different kinds of keyboards, mappings, and fonts that
you might be encountering, but where you have

        `1

in a couple of places, it instead should be

        `1'

With the font I am using I can see a difference in the right
single quotes.

Stata has a -hexdump- command that lets you see the hexadecimal
numbers for each character in a file.  I used this command to see
that the hex number for what you have entered as a right single
quote is "b4".  The hex number for the correct right single quote
is "27".

Maybe someone else can help point you to the correct key (or
keyboard sequence) that will give you the correct right single
quote for your keyboard/computer setup.

Ken Higbee    khigbee@stata.com
StataCorp     1-800-STATAPC

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