Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[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 <>
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, 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

// 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
*----------------------------------- end example ----------------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index