Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Fitting the logistic curve to a time-series


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   Dirk Nachbar <Dirk.Nachbar@dwp.gsi.gov.uk>
Subject   Re: st: Fitting the logistic curve to a time-series
Date   Fri, 21 Jul 2006 15:02:26 +0100 (BST)

--- Dirk Nachbar <Dirk.Nachbar@dwp.gsi.gov.uk> wrote:
> my Stata 8.2 won't accept the {b1}.

That's right, I rember that -nl- used a different syntax in Stata 8.2.
However I gave away my Stata 8 manual so I can't look the correct Stata
8.2 syntax up for you. Maybe somebody elso on the list can?

Sorry,
Maarten


*----begin example in Stata 9.2----------------
set more off
capture drop _all
input year	q
1981	.01102246
1982	.01127048
1983	.01152055
1984	.0118841
1985	.01211535
1986	.01247724
1987	.0129496
1988	.01321121
1989	.01319597
1990	.01362598
1991	.014358
1992	.01417304
1993	.01437101
1994	.01509818
1995	.01539195
1996	.01586584
1997	.01686939
1998	.01767208
1999	.01880662
2000	.01914837
2001	.02034989
2002	.02122596
2003	.02201964
2004	.02243478
2005	.02346839
2006	.02428688
end

twoway line q year 

nl ( q = .04/(1+exp(-{b1}*(year-{b2=2000}))) )
est store const
predict qconst
label var qconst "min and max constrained"

nl ( q = {min=0} + {max=.04}/(1+exp(-{b1}*(year-{b2=2000}))) )
nl log4: q year
est store minmax
predict qminmax
label var qminmax "min and max not constrained"

twoway line q qconst qminmax year
/* The graph shows that the unconstrained
   model fits better */

lrtest const minmax
/* hypothesis that min = 0 and
   max = .4 is rejected */

est stats const minmax
/* AIC and BIC also show that the
   unconstrained model fits better */
*----end example in Stata 9.2----------------



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


		
___________________________________________________________ 
Yahoo! Messenger - with free PC-PC calling and photo sharing. http://uk.messenger.yahoo.com
*
*   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