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 on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: RE: nl-function log4-formula


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: nl-function log4-formula
Date   Wed, 16 Nov 2011 14:19:13 +0000

I have a slightly better answer. The two are not equivalent as using the canned -log4- program carries with it some choices for the initial values for parameter search. It's a common experience with -nl- that having good initial values can be crucial to getting a convergent answer. In this case there are 4 parameters and that can bite quite hard if the model is not an especially good fit. 

Nick 
n.j.cox@durham.ac.uk 

Nick Cox

Only that you should take this to Stata tech support if no explanation is forthcoming on the list. They would need to see your data, or data that reproduces your precise problem. 

Nick 
n.j.cox@durham.ac.uk 

Jennyfer Wolf

I tried with the parantheses outside:

2. nl(VAR1={b0}+{b1}/(1+exp(-{b2}*(VAR2-{b3})))) if VAR3=="xxx"

It does not change anything. Still I don't get same reults as with
log4 and only an estimate for b0.
Would you have another idea?

2011/11/16 Nick Cox <n.j.cox@durham.ac.uk>:
> I don't know, but tucking the -if- condition inside the parentheses looks a bit odd. Try moving it outside.
>
> -nl- is a command, not a function.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Jennyfer Wolf
>
> I am working with the nl-function and with the logistic function model log 4.
> Could somebody please explain me why I do not get the same outout if I type:
>
> 1. nl log4: VAR1 VAR2 if VAR3=="xxx"
>
> and
>
> 2. nl(VAR1={b0}+{b1}/(1+exp(-{b2}*(VAR2-{b3}))) if VAR3=="xxx")
>
> Actually 1. should just be an abbreviation of 2.?
> If I run command 1, I get estimates for b0, b1, b2, b3, if I run
> command 2 I only get an estimate for b0 and b1-b3 are 0.
>
> Could somebody explain how to write the formula "in full" (like in
> 2.), to get the same results as in the first formula.

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