Re: st: combine two graphs of kernel local polynomial

 From Austin Nichols To statalist@hsphsun2.harvard.edu Subject Re: st: combine two graphs of kernel local polynomial Date Fri, 6 Feb 2009 14:17:35 -0500

Ana Gabriela Guerrero Serdan <ag_guerreroserdan@yahoo.com>:
A good reason to use the -gen- option of -lpoly- and then graph
results is to ensure that both local regressions use the same
bandwidth (and of course use the same kernel and degree).  Here I use
a call to -lpoly- using both treat==1 and treat==0 samples to select
the default bandwidth and smoothing grid:

clear all
drawnorm a w, n(1000)
g expw=exp(w)
g age=100+int(a*10)
g treated=uniform()<.5
g z=age/10+treated+2*invnorm(uniform())
lpoly z age if treated==1 [aw=expw], gen(x y) nogr
loc b=r(bwidth)
lpoly z age if treated==1 [aw=expw], nogr at(x) bw(`b') gen(y1) se(s1)
lpoly z age if treated==0 [aw=expw], nogr at(x) bw(`b') gen(y0) se(s0)
g u1=y1+invnormal(.975)*s1
g l1=y1-invnormal(.975)*s1
g u0=y0+invnormal(.975)*s0
g l0=y0-invnormal(.975)*s0
tw rarea l0 u0 x||rarea l1 u1 x||line y0 x||line y1 x

On Fri, Feb 6, 2009 at 1:35 PM, Ana Gabriela Guerrero Serdan
<ag_guerreroserdan@yahoo.com> wrote:
> Dear all,
>
> I want to do a graph of two kernel local polynomial smoothing regressions.
*
*   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/