Hello,
I would like to graph a nonparametric regression of y on x. The graph
should include 95% confidence intervals for the nonparametric
regression which account for clustering of the errors over each
individual in the data (as well as plotting an extra unrelated line).
Here is some code:
clear
set obs 100
set seed 1234
gen id = _n
gen e = uniform()
expand 5
gen x = uniform()
gen y = -.6 + 1.4*x + e
twoway (lpolyci y x) (line x x)
This is what I want, except that I want the drawn 95% confidence
intervals to account for clustering of the error within individuals.
That is, I would love to be able to run code like
twoway (lpolyci y x, cluster(id)) (line x x)
but Stata does not like this.
The pictures are to qualitatively illustrate a point, so I am not
wedded to the local polynomial regression, and thus would be fine with
other types of nonparametric regression (someone mentioned Fan
regression to me) if the graph I want can be implemented with
confidence bounds accounting for clustering in Stata.
Thanks a lot.
*
* 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/