Statalist


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

Re: st: Frapoly


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Frapoly
Date   Mon, 11 Feb 2008 09:46:24 +0000 (GMT)

--- mai mai <mai7777@gmail.com> wrote:
> Is there a why to find out the inflection points, trough and top of
> the fracpoly or fracplot graph?

You are basically asking when the first and second derivative are zero.
I find a graph of the first or second derivative with confidence
intervals against your explanatory variable instructive as it also
gives some sense of the precision of the estimate. These are pretty
subtle features of the curve so you can expect quite a bit of
uncertainty which just a point estimate tends to hide. -fracpoly- fits
a polynomial, so the first and second derivatives are pretty easy to
derive (though as I am lazy and sloppy I find a page like this
invaluable: http://www.quickmath.com/ ). Once you have derived the
first and second derivative you can use -predictnl- to get predictions
of the first and second derivative with their confidence intervals,
which you can than graph. In the example below I illustrate this
procedure with the first derivative.

Hope this helps,
Maarten

*------------------- begin example ---------------------
sysuse nlsw88, clear
gen ln_w = ln(wage)
fracpoly reg ln_w ttl_exp
return list

local x "(`e(fp_x1)'-`e(fp_shft)')/`e(fp_sfac)'"

predictnl dydx = _b[Ittl___1]*2*`x' +                ///
                 _b[Ittl___2]*(2*ln(`x')*`x' + `x'), ///
	         ci(lb ub)

sort ttl_exp
twoway rarea lb ub ttl_exp || ///
       line dydx ttl_exp,     ///
       yline(0) legend(off)
*--------------------------- end example --------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )


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

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

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


      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.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