Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sandbox kernels confint missing alpha #1231

Closed
josef-pkt opened this issue Dec 14, 2013 · 2 comments

Comments

Projects
None yet
1 participant
@josef-pkt
Copy link
Member

commented Dec 14, 2013

It looks like the confint in sandbox.nonparametric kernels have hard coded 1 sigma confidence interval, instead of critical value norm.isf(alpha/2)

I'm not able to reproduce the standard errors of Stata yet, but it looks like they are in the same neighborhood. (I haven't tried to figure out the details of the pilot bandwidth of Stata).

Mean prediction for epa2 with fixed bandwidth=1 seems to match.

update:

In my initial plot of confints for all kernels the confidence interval looks much too small. Compared to Stata the implied standard deviation for gaussian is much smaller (about half with pilot bandwidth=1).

Staring at the source, I don't don't understand enough and cannot figure out what the corresponding formulas in Haerdle's book are.
updated link http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/ebooks/html/anr/anrhtmlframe62.html
Haerdle's sigma_hat(x) is misleading ?, because in step 2 it uses (Y_i - m_hat(x))**2 instead of what I expected
and what's implemented in kernels: (Y_i - m_hat(X_i))**2

Bruce Hansen has a clearer and shorted description of the estimate of the conditional error variance sigma(x)
http://www.ssc.wisc.edu/~bhansen/718/NonParametrics2.pdf
Bruce uses just a kernel regression on e_hat**2, where e_hat = Y_i - m_hat(X_i) to get the error variance.

Note: I think we assume heteroscedasticity here (based on comments by Bruce Hansen and the calculation). Assuming a constant sigma_error, it could just be estimated by the mean of e_hat**2, but in my test case there is a large heteroscedasticity and the constant sigma assumption doesn't produce good results.

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 14, 2013

I'm going to add benchmark results from Stata, but in the kernels I checked so far only the predicted values (conditional expectation) looks correct.

@josef-pkt

This comment has been minimized.

Copy link
Member Author

commented Dec 18, 2013

Not exactly verified but se and confint are approximately the same as Stata's which uses a different se estimator

PR #1233 merged in 62a7c7e

@josef-pkt josef-pkt closed this Dec 18, 2013

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.