Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st:propensity score matchign graph


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st:propensity score matchign graph
Date   Thu, 28 Jun 2007 21:07:03 +0100

I find that variations on 

twoway kdensity mpg if foreign || kdensity mpg if !foreign 

are one of the quickest ways in to superimposed densities. 
Naturally, options would need to be added twice if the 
defaults were not suitable. 

Nick 
[email protected] 

Austin Nichols
 
> Celia Patricia Vera <[email protected]>:
> In my previous msg, there were a couple of missing pieces, inserted in
> situ below. I also did all the graphs using mpg as pscore, so the
> units are integers greater than one, not proportions.  You may want
> to:
>  gen pscore=_pscore*100
> before you run any of my code, and/or adapt the code to your units as
> appropriate.  Here's one more or less complete example illustrating
> histogram, rectangle and epanechnikov kernel estimates of density:
> 
> clear
> sysuse auto
> qui psmatch2 for mpg, out(pr)
> gen pscore=_pscore*100
> twoway__histogram_gen psc if for==0, w(1) gen(f0 x0)
> twoway__histogram_gen psc if for==1, w(1) gen(f1 x1)
> line f0 x0 || line f1 x1, leg(lab(1 "Untreated") lab(2 
> "Treated")) name(h)
> su pscore, meanonly
> loc lb=floor(r(min))
> loc ub=ceil(r(max))
> loc r=`ub'-`lb'
> if _N<`r' set obs `r'
> g x=_n-1+`lb'
> replace x=. if x>`ub'
> kdens pscore if for==0, at(x) gen(t0) nogr
> kdens pscore if for==1, at(x) gen(t1) nogr
> line t0 t1 x, leg(lab(1 "Untreated") lab(2 "Treated")) name(e)
> forv i=0/1 {
>  kdens pscore if for==`i', at(x) gen(r`i') k(r) a(1) nogr
>  replace r`i'=. if r`i'==0
> }
> line r0 r1 x, leg(lab(1 "Untreated") lab(2 "Treated")) name(r)

> > On 6/28/07, Celia Patricia Vera <[email protected]> wrote:
> > > I want to graph the density function  for the
> > > propensity score for both treated and no treated (in
> > > the same graph) in order to see the overlapping
> > > regions.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index