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

Adding confidence intervals to plot from simulation data in R

I've created a probit simulation based on a likelihood function and simulation, all of which can be replicated with the code below. This is the likelihood function: probit.ll <- function(par,ytilde,x) { a <- par[1] b <- par[2] return( -sum(…
Captain Murphy
  • 855
  • 3
  • 15
  • 23
5
votes
1 answer

Calculate and plot 95% confidence intervals of a generalised nonlinear model

I have built several generalised nonlinear least squares models (exponential decay) with the R package nlme and the contained gnls() function. The reason I do not simply build nonlinear least squares models with the base nls() function is because I…
5
votes
0 answers

How to reproduce the same logical reasoning about overlapping contours on a triplot joint distribution

I have the following figure whose I want to apply the same logical reasoning for plotting all the contour and content of different ellipses (identified by a color). In this example, there are 4 matrices plotted instead in my case below, I have 5…
user1773603
5
votes
1 answer

What is the difference between "confint" and "confint.default" when calculating confidence intervals for a logit model in R?

I want to calculate confidence intervals for some parameters of a logit model in R. I have read the documentation of both confint and confint.default but I haven't been able to understand the information about when it is appropriate to apply each…
5
votes
2 answers

How to get confidence intervals for predicted probability plot using {ggeffects} based on nnet::multinom() model?

I want to plot the predicted probabilities for a multinomial model in R, fitted with the nnet::multinom() function. I have numerical predictors on the log scale. Even though {ggeffects} should be compatible with multinom(), the plot does not display…
5
votes
1 answer

Gnuplot: linespoint with confidence interval

I've following data: I want to plot a graph shows for all x the mean connected with lines (linespoint) and also showing all the confidence interval [ci_lower, ci_upper]. I managed to do that using 2 plots. set xrange [0:1100000] set yrange…
Will
  • 2,858
  • 6
  • 33
  • 50
5
votes
1 answer

Label the lower and upper confidence interval bars with numerical values using geom_text()

Problem I produced plot 1 (see R code below) using the package ggplot() and my ultimate goal is to label both the upper and lower confidence interval bars with their values to 3 significant figures (stated in the table below) on the plot by aligning…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
5
votes
2 answers

How to calculate one-sided tolerance interval with scipy

I would like to calculate a one sided tolerance bound based on the normal distribution given a data set with known N (sample size), standard deviation, and mean. If the interval were two sided I would do the following: conf_int =…
Gigi
  • 347
  • 4
  • 11
5
votes
1 answer

Plotting mean monthly temperature in ggplot with confidence intervals

I need to plot mean monthly temperature and have the month abbreviated on the x axis, and I need to add 95% confidence intervals but not sure how. Any visual of CI's would be good. Then I need to plot I got Date...Time split out into separate…
Johnny5ish
  • 295
  • 1
  • 2
  • 12
5
votes
0 answers

Correlation between two scores where one of scores has a confidence interval

scipy.stats module has several metrics like pearsonr, spearmanr to compute the correlation between two set of scores. In my case, one set of the scores are actually mean of multiple scores and so I have a confidence interval for each score. Is there…
Nagabhushan S N
  • 6,407
  • 8
  • 44
  • 87
5
votes
1 answer

How to bootstrap Mixed-Effects Model in R

I have a data set (df) in this format index <- runif(n = 100,min = 0, max = 1) type1 <- rep("low", 50) type2 <- rep("high", 50) type <- c(type1,type2) level1 <- rep("single", 25) level2 <- rep("multiple", 25) level3 <- rep("single", 25) level4 <-…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
5
votes
1 answer

Fast Wald confidence intervals for a glm with broom in R

I would like to calculate Wald confidence intervals of the coefficients of a glm on a somewhat large data set, and use broom for a tidy output. mydata <- data.frame(y = rbinom(1e5,1,0.8), x1 = rnorm(1e5), x2 =…
bebru
  • 151
  • 9
5
votes
1 answer

Calculating Confidence Interval for a Proportion in One Sample

What would be a better way to calculate Confidence Interval (CI) for a proportion when the sample size is small and even the sample size is 1? I am currently calculating CI for a Proportion in One Sample w/: However, my sample size is very small,…
Sharedobe
  • 135
  • 1
  • 9
5
votes
1 answer

Multiple linear regression: Plot a straight line with confidence intervals

Here is my question: 1) I ran a multiple linear regression: suppose like: lm(attitude~quality+price+location+Income) I mainly care about the relationship between attitude and quality, and other variables are control variables. 2) Then I wanted to…
Will
  • 51
  • 4
5
votes
3 answers

Calculate age standardised rates by sub-group with confidence intervals in R

I have a dataframe which looks like this: df <- data.frame ( time = rep(c("2010", "2011", "2012", "2013", "2014"),4), age = rep(c("40-44", "45-49", "50-54", "55-59", "60-64"),4), weight = rep(c(0.38, 0.23, 0.19, 0.12, 0.08),4), ethnic =…
Laura
  • 499
  • 5
  • 13