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

How to get confidence intervals for lmer object?

I am trying to get confidence intervals for predictions on the mixed model. The predict function does not output any confidence intervals. Few StackOverflow answers suggested using predictInterval function from the merTools package to obtain the…
magnum
  • 51
  • 1
  • 6
5
votes
2 answers

R: Bootstrap percentile confidence interval

library(boot) set.seed(1) x=sample(0:1000,1000) y=function(u,i) sum(x[i]) o=boot(x,y,1000) theta1=NULL theta1=cbind(theta1,o$t) b=theta1[order(theta1)] bp1=c(b[25], b[975]) ci=boot.ci(o,type="perc") I am using two method to construct bootstrap…
yap
  • 61
  • 6
5
votes
2 answers

Confidence interval for xgboost regression in R

I am currently working on a dataset that contains 4 categorical input variables and one numeric output. I created a model, using the xgboost package in R. But I cannot find a way to compute a CI. How can I compute the confidence interval for my…
5
votes
3 answers

Determining High Density Region for a distribution in R

Background: Normally, R gives quantiles for well-known distributions. Out of these quantiles, the lower 2.5% up to the upper 97.5% covers 95% of the area under these distributions. Question: Suppose I have a F distribution (df1 = 10, df2 = 90). In…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
5
votes
2 answers

Change confidence interval format in package metafor forest graph?

Assume the code below (as given in Viechtbauer, 2010): library(metafor) data("dat.bcg", package = "metafor") dat <- escalc(measure = "RR", ai = tpos, bi = tneg, ci = cpos, di = cneg, data = dat.bcg, append = TRUE) res <- rma(ai = tpos, bi = tneg, ci…
M. Er
  • 881
  • 1
  • 7
  • 13
5
votes
3 answers

lme4 calculate confidence intervals of covariances

Please see answer from Ben Bolker 16/05/2016 for the appropriate solution. OP below. I am fitting several multilevel models with lme4. I would like to report the variances and covariances of the random effects, and to automate this process. I know…
r.kaiza
  • 145
  • 8
5
votes
2 answers

How to extract attributes values from svyciprop object?

How can I extract attributes from svyciprop object below to a data.frame: library(survey) api <- read.dta(file = "http://www.ats.ucla.edu/stat/stata/library/apipop.dta") data(api) dclus1 <- svydesign(id=~dnum, fpc=~fpc, data=apiclus1) prop.ci <-…
FFI
  • 392
  • 1
  • 10
5
votes
0 answers

How to calculate confidence interval for orthogonal distance regression line fit in python

I am using orthogonal distance regression method(scipy.odr) to fit my data, after fit, I have trouble in calculate the 95% confidence interval, please help me no how to calculate it~ here the code: #define fit function def def f(p,x): return…
Owen
  • 397
  • 7
  • 18
5
votes
0 answers

gbm confidence intervals in R?

Anybody know how to calculate confidence intervals from the gbm.predict() function? I'd like a method to ascertain a 95% confidence band on my gbm predictions.
5
votes
2 answers

R proportion confidence interval factor

I am trying to summarise data from a household survey and as such most of my data is categorical (factor) data. I was looking to summarise it with plots of frequencies of responses to certain questions (e.g., a bar plot of percentages of households…
marty_c
  • 5,779
  • 5
  • 24
  • 27
5
votes
2 answers

Estimating confidence intervals of a Markov transition matrix

I have a series of n=400 sequences of varying length containing the letters ACGTE. For example, the probability of having C after A is: and which can be calculated from the set of empirical sequences, thus Assuming: Then I get a transition…
HCAI
  • 2,213
  • 8
  • 33
  • 65
5
votes
1 answer

randomForest in R: Is there a possibility of calculating casewise confidence intervals?

R package randomForest reports mean squared errors for each tree in the forest. I need, however, a measure of confidence for each case in the data. Since randomForest calculates the casewise predictions by averaging the predictions of the single…
user7417
  • 1,531
  • 3
  • 15
  • 20
4
votes
3 answers

Two Factor ANOVA Errorbar plot in R

We're teaching a stats class for biology students and trying to use R as the computing and data visualization platform. As much as possible, we'd like to avoid using extra packages and doing anything terribly "fancy" in R; the focus of the course…
James Waters
  • 323
  • 1
  • 3
  • 9
4
votes
1 answer

Extract the confidence intervals of lmer random effects; plotted with dotplot(ranef())

I´m trying to extract the confidence intervals and the intercept values that are plotted with dotplot(ranef()). How can I do this? attach(sleepstudy) library(lme4) fm1 <- lmer(Reaction ~ Days + (Days | Subject),…
Luis M. García
  • 123
  • 2
  • 9
4
votes
3 answers

How can I plot a function with errors in coefficients?

This is a question similar to my earlier post, but I really have no idea how to do that (so I didn't include my code). Suppose I have a quadratic function y = 0.06(+/-0.16)x**2 - 0.65(+/-0.04)x + 1.2(+/-0.001) The numbers after +/- sign represent…
ZR-
  • 809
  • 1
  • 4
  • 12