FAQ
Hello,

I am fitting data using different methods e.g. Local Polynomial and Smoothing splines. The data is generated out of a true function model with added normally distributed noise.

I would like to know "how often the confidence band for all points simultaneously contain all true values". I can answer the question for one point in the following way:

e.g.

# =========================================================================================
# How many times the pointwise confidence interval at x=0.5 contains the true value at 0.5
# i.e. what is the so called "coverage rate"?
# =========================================================================================
pos = which(x==0.5)
sum(abs(estlp[pos,] - m(x[pos])) <= 1.96*selp[pos,]) # equidistant x outputs 946
# non-equidistant x outputs 938
sum(abs(estss[pos,] - m(x[pos])) <= 1.96*sess[pos,]) # equidistant x outputs 895
# non-equidistant x outputs 936

This basically tells me that out of 1000 simulation runs with different random noise, 946 times the true value i.e. m(x) for x=0.5 is contained within the 95% confidence interval. The estlp Local Polynomial performs better than Smoothing Splines under this criteria ...

Now is there any specific way to answer "how often the confidence band for all points simultaneously contain all true values" other than this below?

# =========================================================================================
# How often does the confidence band for all points simultaneously contain all true values?
# =========================================================================================
sum(abs(estlp[,] - m(x[])) <= 1.96*selp[,]) # equidistant x outputs 92560
# non-equidistant x outputs 92109
sum(abs(estss[,] - m(x[])) <= 1.96*sess[,]) # equidistant x outputs 90804
# non-equidistant x outputs 94641

Is there a dedicated function in R for this purpose i.e. to build confidence bands around a given fit ... maybe a way to plot it nicely too given that the Estimated SE are calculated.

Best regards,
Giovanni

## Related Discussions

 view thread | post posts ‹ prev | 1 of 1 | next ›
Discussion Overview
 group r-help categories r posted Mar 27, '10 at 3:44p active Mar 27, '10 at 3:44p posts 1 users 1 website r-project.org irc #r

### 1 user in discussion

Content

People

Support

Translate

site design / logo © 2022 Grokbase