Questions tagged [confidence-interval]

In statistics, a confidence interval is a measure of the precision of an estimate of an underlying parameter. In principle, if the estimate is computed several times on independent samples of data, the parameter should fall within associated confidence intervals a set proportion of the time. This proportion is known as the coverage probability, and is most commonly set to be 95%.

When estimating a vector of parameters, c(θ), based on observations of some random variables whose distribution depends on those parameters in some way, a confidence interval (for scalar θ) or confidence region (for vector c(θ)), is some set C=C(X) such that P(c(θ) ∈ C) = 1−α. To note:

  1. The confidence interval is a function of the data, X, so is itself random.
  2. The statement regarding the probability that c(θ) ∈ C should be regarded with respect to the randomness in X which controls C. Since confidence intervals are a frequentist notion, one should not think of the probability as applying to the unobserved parameter c(θ), which, to a frequentist, is not random.
  3. Often one can only compute approximate confidence intervals, which may have the nominal coverage asymptotically in the sample size.

Tag usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

1131 questions
7
votes
2 answers

How to interpret the upper/lower bound of a datapoint with confidence intervals?

Given a list of values: >>> from scipy import stats >>> import numpy as np >>> x = list(range(100)) Using student t-test, I can find the confidence interval of the distribution at the mean with an alpha of 0.1 (i.e. at 90% confidence) with: def…
alvas
  • 115,346
  • 109
  • 446
  • 738
7
votes
2 answers

How to draw an $\alpha$ confidence areas on a 2D-plot?

There are a lot of answers regarding to plotting confidence intervals. I'm reading the paper by Lourme A. et al (2016) and I'd like to draw the 90% confidence boundary and the 10% exceptional points like in the Fig. 2 from the paper: . I can't use…
Nick
  • 1,086
  • 7
  • 21
7
votes
1 answer

Confidence interval of polynomial regression

I have a little issue with R and statistics. I fitted a model with the Maximum Likelihood method, who gave me the following coefficients with their respective Standard Errors (among other parameters estimates): ParamIndex Estimate SE …
trantsyx
  • 149
  • 1
  • 12
7
votes
1 answer

How to obtain a confidence interval or a measure of prediction dispersion when using xgboost for classification?

How to obtain a confidence interval or a measure of prediction dispersion when using xgboost for classification? So for example, if xgboost predicts a probability of an event is 0.9, how can the confidence in that probability be obtained? Also is…
Greg
  • 8,175
  • 16
  • 72
  • 125
7
votes
1 answer

Confint() with glm {stats} very, very slow

I have a problem with calculating OR confidence intervals from a glm in the latest version of R, but I have not had this issue before. With any glm where family="binomial", no matter how simple the model is, it will easily allow me to extract the…
user4575913
  • 507
  • 1
  • 7
  • 16
7
votes
1 answer

R - Color or shade area between lines

I'm trying to replicate with R a chart I made on Excel, which should represent a 95% Confidence Interval (CI) around a time series forecast. The Excel chart looks like this: So, basically, the original historical time series and from a certain…
Riccardo
  • 337
  • 1
  • 2
  • 7
7
votes
1 answer

Gaussian-Process Prediction Confidence Interval Oddities

I'm doing some particle physics analysis and was hoping someone out there could give me some insight on a Gaussian-Process fit I'm trying to use to extrapolate some data. I have data with uncertainties that I'm feeding in to the scikit-learn…
7
votes
3 answers

Conditionally colour data points outside of confidence bands in R

I need to colour datapoints that are outside of the the confidence bands on the plot below differently from those within the bands. Should I add a separate column to my dataset to record whether the data points are within the confidence bands? Can…
D W
  • 2,979
  • 4
  • 34
  • 45
7
votes
1 answer

profile confidence intervals in R: mle2

I am trying to use the command mle2, in the package bbmle. I am looking at p2 of "Maximum likelihood estimation and analysis with the bbmle package" by Bolker. Somehow I fail to enter the right start values. Here's the reproducible…
EOM
  • 71
  • 2
6
votes
1 answer

Showing 95% Confidence Interval using table1 in R

I have demographic data and for some of the variables I want to show Mean (95% CI) So far: > label (demog$Site) = "Site" > label (demog$Sex) = "Sex" > label (demog$Age) = "Age (years)" > label (demog$Temperature) = "Temperature (Celcius)" > label…
ajmoo
  • 61
  • 2
6
votes
1 answer

Confidence Interval/Margin of Recall or Precision

If I have a confusion matrix that is based upon a sample set, how do I determine the statistical power (confidence margin/interval) of my recall/precision/etc metrics? I know how to do statistical power analysis for the probability of conversion…
SriK
  • 1,011
  • 1
  • 15
  • 29
6
votes
1 answer

Prediction intervals for ARMA.predict

The Summary of an ARMA prediction for time series (print arma_mod.summary()) shows some numbers about the confidence interval. Is it possible to use these numbers as prediction intervals in the plot which shows predicted values? ax =…
6
votes
2 answers

Confidence regions of 1sigma for a 2D plot

I have two variables that I have plotted using matplotlib scatter function. I would like to show the 68% confidence region by highlighting it in the plot. I know to show it in a histogram, but I don't know how to do it for a 2D plot like this (x vs…
Srivatsan
  • 9,225
  • 13
  • 58
  • 83
5
votes
1 answer

xyplot with confidence interval (box and wisker plot) added in r

I want to add 99% and 95% confidence interval in XYplot. The following is data: X <- 1:20 Y <- c(0.5, 1.4, 2.3, 3.4, 4.5, 3.3, 3.0, 2.1, 1.5, 0, 0, 3.4, 4.5, 6.7, 5.3, 2.8, 0.5, 3.4, 3.5, 3.7) mydata <- data.frame (X, Y) I want…
jon
  • 11,186
  • 19
  • 80
  • 132
5
votes
1 answer

Bootstrap Confidence Intervals in R

I am a new R user, and am having trouble using the boot package. All I want to do is use bootstrapping to produce confidence intervals around a mean for a vector of numbers, such as: x <- rnorm(100, 1, .5) Any tips?
mike
  • 22,931
  • 31
  • 77
  • 100