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@princeton.edu

www.princeton.edu/~skushner