sandbox kernels confint missing alpha #1231

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

Projects

None yet

1 participant

@josef-pkt
Member

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
Member

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 josef-pkt added a commit to josef-pkt/statsmodels that referenced this issue Dec 15, 2013
@josef-pkt josef-pkt BUG: fix kernels smoothconf standard error, rename Biweight.smoothcon…
…f see #1231
29b9075
@josef-pkt josef-pkt added a commit to josef-pkt/statsmodels that referenced this issue Dec 15, 2013
@josef-pkt josef-pkt TST: kernels smoothconf against Stata, confint is only approx. see #1231
cf92ff4
@josef-pkt
Member

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 PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@josef-pkt josef-pkt BUG: fix kernels smoothconf standard error, rename Biweight.smoothcon…
…f see #1231
a770e23
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@josef-pkt josef-pkt TST: kernels smoothconf against Stata, confint is only approx. see #1231
196cf29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment