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: Graphical part of RD analysis


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Graphical part of RD analysis
Date   Wed, 3 Nov 2010 14:04:31 -0400

Jen Zhen <[email protected]>:

Try this (fake) example using the scopt option of -rd- (SSC):

webuse nhanes2, clear
g bmi=weight/height^2*10000
g z=bmi-35
gen b=z-mod(z,5)+2.5
egen m=mean(highbp), by(b)
loc o "graph mbw(100) sco(ms(i) xli(0)||sc m b) line(xti(BMI less 35))"
rd highbp z if inrange(z,-20,20), bw(3) `o'

On Wed, Nov 3, 2010 at 1:08 PM, Jen Zhen <[email protected]> wrote:
> Hi,
>
> for a RD analysis, I would like to assign my observations into bins of
> the running variable (age), and then plot the mean outcome value for
> each bin, along with 2 separate fitted lines, one on the left and one
> on the right side of the threshold, as recommended for instance in
> Austin Nichols' "Causal Inference with Observational Data" (2007),
> p.17.
>
> I am currently doing this with the following code to get these means
> into the browsing window, then I paste them into Excel, where I plot
> them and add the fitted lines:
>
> egen age_bins = cut(age), at(45(0.5)56)
> bysort age_bins: egen mean_outcome = mean (outcome)
> preserve
> keep age_bins mean_outcome
> bysort age_bins (mean_outcome): keep if _n==1
> browse
> restore
>
> I'm wondering though whether there is some more straightforward
> procedure for this in Stata?
> Austin's - rd ..., gr - will plot the two fitted lines together with
> dots for all observations, but how can I plot only the age bin
> averages?
>
> Many thanks,
> JZ
*
*   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