# Re: st: combine two graphs of kernel local polynomial

 From Ana Gabriela Guerrero Serdan To statalist@hsphsun2.harvard.edu Subject Re: st: combine two graphs of kernel local polynomial Date Sun, 15 Feb 2009 12:35:12 -0800 (PST)

```Thanks, this was very useful.

For this purpose, I think its clearer without the CIs.

--- On Fri, 2/6/09, Austin Nichols <austinnichols@gmail.com> wrote:

> From: Austin Nichols <austinnichols@gmail.com>
> Subject: Re: st: combine two graphs of kernel local polynomial
> To: statalist@hsphsun2.harvard.edu
> Date: Friday, February 6, 2009, 1:17 PM
> 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/

*
*   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/
```