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: non linear equation difficulties with nl function evaluation program


From   Maarten buis <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index