Shana,
If you want to replicate the AJPS plot without adding anything then the
easiest way would be to tell Stata that ther code was written for an
older version of Stata. For example, at the top of your .do file you
could put "version 7", and Stata will interpret the code as having been
written for version 7, which I believe still used the older graph
commands. For details on version control see "help version" in Stata.
Best of luck with your research,
Jason
Shana Kushner Gadarian wrote:
Hi -
I'm trying to create a predicted probability graph that includes confidence
intervals with data simulated with Clarify. Using the instructions from the
Clarify manual about how to recreate the graphs from the 2001 AJPS article,
I'm having some trouble in part b/c I think that the graphing commands in
the manual are somewhat different than the ones that Stata 10 uses.
What I need to know is what the right Stata 10 command is after "graph" in
the original instructions that will give me a line graph with confidence
intervals. Right now I'm using the "lfit" command (see my code below) but
that isn't right.
Any help would be much appreciated. Thanks!
Here are the instructions from the Clarify manual to create a graph with 99%
CI:
generate plo = .
generate phi = .
generate ageaxis = _n + 17 in 1/78
setx educate 12 white 1 income mean
local a = 18
while `a' <= 95 {
setx age `a' agesqrd (`a'^2)/100
simqi, prval(1) genpr(pi)
_pctile pi, p(2.5,97.5)
replace plo = r(r1) if ageaxis==`a'
replace phi = r(r2) if ageaxis==`a'
drop pi
local a = `a' + 1
}
sort ageaxis
graph plo phi ageaxis, s(ii) c(||)
Here is the code that I'm using from my data.
estsimp regress index02 Ideology pid AvgTV02_hat newspaper02_hat if
ThreatTerror02 < .5
generate plo = .
label var plo "Low threat"
generate TVaxis = _n-1 in 1/100
label var TVaxis "Days watching TV per week"
setx mean
setx AvgTV02_hat 0
local a = 1
local b = 0
while `a'<= 100 {
setx AvgTV02_hat (`b')
simqi, ev genev(pi)
_pctile pi, p(5,95)
replace plo = pi if TVaxis == `a'
drop pi
local a = `a' + 1
local b = `b' +.01
}
drop b1-b5 b6
estsimp regress index02 Ideology pid AvgTV02_hat newspaper02_hat if
ThreatTerror02 > .5
generate phi = .
label var phi "High threat"
setx mean
setx mean
local a = 1
local b = 0
while `a'<= 100 {
setx AvgTV02_hat (`b')
simqi, ev genev(pi)
_pctile pi, p(5,95)
replace phi = pi if TVaxis == `a'
drop pi
local a = `a' + 1
local b = `b' + .01
}
replace TVaxis = TVaxis/100
sort TVaxis
*Predicted values for IV model - included in the job talk*
twoway (lfit plo TVaxis, lcolor(blue) lpattern(shortdash_dot)) (lfit phi
TVaxis, lcolor(navy) lpattern(longdash)), ytitle(Hawkishness)
ylabel(.2(.1).8) xtitle(TV watching per week) xlabel( 0 "No TV" .5 "Mean
TV"
1 "Every day", angle(horizontal) labsize(small)) title(Foreign Policy
Attitudes 2002) caption(IV predicted values, size(small)) note(Source:
2000-2004 NES, size(small)) legend(rows(1) order(1 "Low threat" 2 "High
threat") size(small)) scheme(s1color)
Shana
Shana Kushner Gadarian
Department of Politics
Princeton University
skushner(a)princeton.edu
www.princeton.edu/~skushner
--
Jason Wittenberg
Department of Political Science
210 Barrows Hall
University of California, Berkeley
Berkeley, CA 94720-1950
Tel: (510) 642-8407
Fax: (510) 642-9515
email: witty(a)berkeley.edu
Web:
http://www.polisci.berkeley.edu/faculty/bio/permanent/Wittenberg,J/
My NEW BOOK:
http://www.cambridge.org/us/catalogue/catalogue.asp?isbn=0521849128
--
Clarify mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=clarify