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: Shapes of two Inverted U curves (same model on two different samples)


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Shapes of two Inverted U curves (same model on two different samples)
Date   Tue, 5 Jul 2011 11:30:33 +0200

On Tue, Jul 5, 2011 at 11:16 AM, L.M.A. Mulotte wrote:
> Now, are there any means to graph the two Inverted-U curves on the same graph?

*------------------------- begin example --------------------------
use http://www.stata-press.com/data/r11/nlswork, clear
// estimate the model
reg ln_wage  i.south i.south#(c.age##c.age c.grade c.birth_yr)

// we change the data in ways we will not want to store
preserve

// fix remaining variables at their mean value
sum grade if e(sample), meanonly
replace grade = r(mean)
sum birth_yr if e(sample), meanonly
replace birth_yr = r(mean)

// predict log wage
predict yhat

// sperate curves for south and north
separate yhat, by(south)

// we only need one observation per age/south combination
// this makes the graph smaller and quicker
bys age south : gen byte mark = _n == 1

// create the graph
twoway line yhat? age if mark

// get original data back
restore
*----------------------------------- end example ----------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

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