Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: non linear equation difficulties with nl function evaluation program


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: non linear equation difficulties with nl function evaluation program
Date   Wed, 25 Aug 2010 07:19:58 +0000 (GMT)

--- On Tue, 24/8/10, Carolina Lopez wrote:
> I am working on the estimation of this transport cost
> function, and getting issues with the func prog using nl:
> lcostratio= { [a(1+a+(n-2))] / [(1+a-k)(1+a+k(n-1)] } {
> b1lpko+b2lsalratio} - { [ak] / [ 1+a-k)(1+a+k(n-1)] }
> { b3sum_lpko + b4sum_lsalratio  } + { [1+(n-1)k ] / 
> [ [ 1+a+k(n-1)]} lna

<snip>

> I am not sure I am introducing n correctly here, since I do
> not expect a parameter, I just want it to feed data for my 
> terms.

I guess n is just the number of observations, you can access
that using _N, if you have missing values I would outside
the evaluator progam do something like 

count if !missing(var1, var2, ...)
global S_N = r(N)

And than inside the evaluator program refer to n as $S_N.

In general, the way to debug such a program is to simplify,
start with a very simple version of that function, get that
to work, add a parameter, get that to work, etc, etc.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index