Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: How to plot bootstrap CI for the entire kernel estimation of y on x?


From   Eik Leong Swee <eikswee@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: How to plot bootstrap CI for the entire kernel estimation of y on x?
Date   Sat, 5 Feb 2005 10:45:06 -0800 (PST)

Firstly, thanks so much for the reply. I'm not sure what is the difference between kernreg2 and
locpoly.

My theoretical understanding of kernel estimation (y on x) is a locally weighted averaging (using
a prespecified kernel function eg. normal or epanechnikov) method of fit where the bandwidth is
simply a measure of applying weights to distant observations. The optimal bandwidth is chosen to
minimise the mean itegrated squared error or so-called cross validation (CV).

Given the above, would you suggest I use kernreg2 or locpoly? Is the optimal bandwidth chosen in
each case using CV?

Another question is regarding graphing the kernel estimates and bootstrap confidence intervals. I
have seen in some journals where kernel regressions (y on x) were used and bootstrap CI were
plotted around the kernel estimates. I encountered 3 problems here. Firstly, I could not save
kernreg graphs like I could with scatter plots. Secondly, I know how to calculate bootstrap CI but
dont know how to plot them on a graph. Lastly, how do I plot both together on one graph?

I thank anyone who's able to offer advice here in advance.

Eik


>Nick Cox  wrote:
> -kernreg2-, of which I am notionally first
> author, was intended to be a temporary fix
> of -kernreg-, written by other people.
>
> It didn't turn out that way, but no matter:
> -locpoly- is now the recommended command,
> in my view. In short, -kernreg2- is history,
> except that it remains in the archives out
> of inertia and for people still on earlier
> versions of Stata.
>
> However, both of them stop a long way short
> of offering this kind of functionality.
>
> Having said that, my own personal view is
> that kernel regression is not obviously
> the best thing for summarising how a
> binary response varies with a predictor.
> I can't offer more positive advice because
> I am unclear on how far your problem is
> tractable at all.
>
> Nick
> n.j.cox@d...
>
> Eik Leong Swee
>
> > I am trying to do a kernel density estimation of a y ( a 0-1 variable)
> > on x1. This generates Graph1. I also did an estimation on y on x2 and
> > generated graph2. I used kernreg2 for both these estimations.
> >
> > Now, I would also like to bootstrap confidence intervals around the
> > graph and subsequently test the two distributions from graph 1 and 2
> > (to see if they are statistically different in the relevant range) .
> > Unfortunately, kernreg2 does not give the non-parametric standard
> > errors. I tried bootstrapping nevertheless, and this is the output
> > that I get.
> > Bootstrap statistics
> >
> > Variable | Reps Observed Bias Std. Err. [95% Conf. Interval]
> > ---------+----------------------------------------------------
> > ---------------
> > klnpce | 100 10.69125 .5342394 .9190264 8.867703 12.5148 (N)
> > | 9.449879 13.2954 (P)
> > | 9.095177 11.76517 (BC)
> > --------------------------------------------------------------
> > ---------------
> > N = normal, P = percentile, BC = bias-corrected
> >
> >
> > First I would like to draw confidence intervals for the entire
> > function, and then bootstrap the confidence intervals and am not sure
> > how to do it. I was wondering if anyone had faced this problem, and
> > could help me out.
>
> *
> *   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/



__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index