Statalist


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

Re: st: Spline Plots


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Spline Plots
Date   Tue, 19 Aug 2008 06:39:36 +0100 (BST)

--- [email protected] wrote:
> Does anyone have any recommendations for creating a quadratic spline 
> plot with one knot?

*------------------ begin example ----------------------
sysuse nlsw88, clear

// create quadritic spline
sum hours 
gen zhours = (hours - r(mean))/r(sd)
mkspline shours 2 = zhours, marginal
replace shours1 = shours1^2
replace shours2 = shours2^2

// estimate logit model
logit union zhours shours1 shours2 south tenure

// create graph of predicted probability 
// for people from the with mean tenure
adjust south=0 tenure, by(hours) pr ci replace
twoway rarea lb ub hours || line pr hours, 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 )

Hope this helps,
Maarten

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

Send instant messages to your online friends http://uk.messenger.yahoo.com 
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index