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
9
votes
1 answer

Simple binary logistic regression using MATLAB

I'm working on doing a logistic regression using MATLAB for a simple classification problem. My covariate is one continuous variable ranging between 0 and 1, while my categorical response is a binary variable of 0 (incorrect) or 1 (correct). I'm…
9
votes
1 answer

Adding confidence intervals to a qq plot?

Is there a way to add confidence intervals to a qqplot? I have a dataset of gene expression values, which I've visualized using PCA: pca1 = prcomp(data, scale. = TRUE) I'm now looking for outliers by checking the distribution of the data against the…
user2846211
  • 949
  • 6
  • 16
  • 24
8
votes
1 answer

Using seaborn lineplot with grouping variable

I have a pandas DataFrame that looks like this. 0 1 2 3 4 5 6 7 8 9 Group 0 0.0 0.0 0.0 12.5 12.5 0.0 0.0 12.5 0.0 12.5 1 1 0.0 12.5 12.5 12.5 0.0 0.0 0.0 0.0 …
arcGuesser
  • 127
  • 1
  • 1
  • 9
8
votes
2 answers

Python PCA plot using Hotelling's T2 for a confidence interval

I am trying to apply PCA for Multi variant Analysis and plot the score plot for first two components with Hotelling T2 confidence ellipse in python. I was able to get the scatter plot and I want to add 95% confidence ellipse to the scatter plot. It…
Dr.Who
  • 121
  • 1
  • 6
8
votes
2 answers

Calculating 95% confidence intervals in quantile regression in R using rq function

I would like to get 95% confidence intervals for the regression coefficients of a quantile regression. You can calculate quantile regressions using the rq function of the quantreg package in R (compared to an OLS…
ehi
  • 409
  • 8
  • 23
8
votes
2 answers

Calculate confidence band of least-square fit

I got a question that I fight around for days with now. How do I calculate the (95%) confidence band of a fit? Fitting curves to data is the every day job of every physicist -- so I think this should be implemented somewhere -- but I can't find an…
Suuuehgi
  • 4,547
  • 3
  • 27
  • 32
8
votes
4 answers

Confidence interval of coefficients using Generalized Estimating Equation (GEE)

I am running the linear regression models using generalized estimating equation with geepack. The confint(fit) command does not seem to work in here. For example: f2 <- geeglm(FEV1 ~ Age, data = Hospdata, family=gaussian, id=HHID) …
mani
  • 251
  • 2
  • 6
  • 9
8
votes
1 answer

how to calculate the confidence level for random forest regression model in R

I'm using randomForest package in R, for the purpose of predicting the distances between proteins (regression model in RF) "for a homology modeling purposes" and I obtained quite good results. However, I need to have a confidence level to rank my…
DOSMarter
  • 1,485
  • 5
  • 21
  • 29
8
votes
5 answers

Plot 95% confidence limits in scatterplot

I need to plot several data points that are defined as c(x,y, stdev_x, stdev_y) as a scatter plot with a representation of their 95% confidence limits, for examples showing the point and one contour around it. Ideally I'd like to plot on oval…
7
votes
4 answers

Check interval contains number in R

In R I have the following matrix (each row represents a bootstrap 95% confidence interval generated from the same sample data): low high [1,] 22.2 25.5 [2,] 23.1 25.9 [3,] 23.4 26.1 ... I know the true population mean of the data,…
dplanet
  • 5,273
  • 9
  • 29
  • 44
7
votes
1 answer

Why doesn't the seaborn plot show a confidence interval / error bars?

I am using sns.lineplot to show the confidence intervals in a plot. sns.lineplot(x = threshold, y = mrl_array, err_style = 'band', ci=95) plt.show() I'm getting the following plot, which doesn't show the confidence interval: What's the problem?
7
votes
3 answers

confidence interval with leastsq fit in scipy python

How to calculate confidence interval for the least square fit (scipy.optimize.leastsq) in python?
casper
  • 181
  • 1
  • 2
  • 4
7
votes
4 answers

How to perform a bootstrap and find 95% confidence interval for the median of a dataset

I am working to perform a bootstrap using the statistic median for dataset "file", containing only one column "Total". This is it: Total <- c(2089, 1567, 1336, 1616, 1590, 1649, 1341, 1614, 1590, 1621, 1621, 1631, 1295, 107, 18, 195, 2059, 870,…
ana57
  • 71
  • 1
  • 2
7
votes
3 answers

Confidence interval for the difference between two proportions in Python

For example, in an AB test the A population could have 1000 data points, of which 100 are successes. While B could have 2000 data points and 220 successes. This gives A a success proportion of 0.1 and B 0.11, the delta of which is 0.01. How can I…
Johnny V
  • 1,108
  • 14
  • 21
7
votes
2 answers

Bootstrapping a vector of results, by group in R

Question: How can I use a boostrap to get confidence intervals for a collection of statistics calculated on the eigenvalues of covariance matrices, separately for each group (factor level) in a data frame? Problem: I can't quite work out the…
user101089
  • 3,756
  • 1
  • 26
  • 53
1 2
3
75 76