confidence-interval

Confidence Interval (CI) simulation in R: How?

一世执手 提交于 2020-02-02 18:56:21
问题 I was wondering how I could check via simulation in R that the 95% Confidence Interval obtained from a binomial test with 5 successes in 15 trials when TRUE p = .5 has a 95% "Coverage Probability" in the long-run? Here is the 95% CI for such a test using R (how can show that the following CI has a 95% coverage in the long-run if TRUE p = .5 ): as.numeric(binom.test(x = 5, n = 15, p = .5)[[4]]) # > [1] 0.1182411 0.6161963 (in the long-run 95% of the time, ".5" is contained within these # two

Adding confidence intervals to a qq plot?

主宰稳场 提交于 2020-02-01 18:34:04
问题 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 normal distribution through: qqnorm(pca1$x,pch = 20, col = c(rep("red", 73), rep("blue", 33))) qqline(pca1$x) This is my data: data = [2.48 104 4.25 219 0.682 0.302 1.09 0.586 90.7 344 13.8 1.17 305 2.8 79.7 3.18 109 0.932 562 0.958 1.87 0.59 114

How do I plot the confidence interval when I provide the C.I. values

瘦欲@ 提交于 2020-01-21 18:47:52
问题 I am NOT plotting from the actual data, I only have a data.frame that list the x, y values as well as the upper and lower confident intervals. I want to plot line graph with confident interval. I want to plot something look like this: How do I do that? Here is the data.frame: grp x y se conf.low conf.high 0 0 66.27373472086 1.51067072892736 63.3124335788501 69.2350358628699 1 0 74.2148696059611 1.40010518400934 71.4703052207858 76.9594339911364 0 0.67 69.3077020704515 1.31170050247573 66

How do I plot the confidence interval when I provide the C.I. values

烂漫一生 提交于 2020-01-21 18:47:52
问题 I am NOT plotting from the actual data, I only have a data.frame that list the x, y values as well as the upper and lower confident intervals. I want to plot line graph with confident interval. I want to plot something look like this: How do I do that? Here is the data.frame: grp x y se conf.low conf.high 0 0 66.27373472086 1.51067072892736 63.3124335788501 69.2350358628699 1 0 74.2148696059611 1.40010518400934 71.4703052207858 76.9594339911364 0 0.67 69.3077020704515 1.31170050247573 66

How can I get confidence intervals for a one-tailed, bootstrapped Pearson correlation in R?

半腔热情 提交于 2020-01-06 09:54:07
问题 I want to calculate 95% bootstrap confidence intervals for a one-tailed, nonparametric bootstrapped Pearson correlation test in R . However, boot.ci only gives two-tailed CIs. How can I calculate one-tailed bootstrap CIs? Here's my code for a one-tailed, bootstrapped Pearson correlation test using cor.test . (It includes boot.ci at the end, which returns two-tailed CI, not desired one-tailed CI. The output is included as comments ( # ) for comparison.) # Load boot package library(boot) # Make

How to compute confidence intervall for Krippendorf's Alpha in R?

寵の児 提交于 2020-01-01 19:32:56
问题 I am sure this is realted to Bootstrapping Krippendorff's Alpha. But I didn't understand the question nor the answers there. And it looks like that even the answers and comments are contradicting each other. set.seed(0) df <- data.frame(a = rep(sample(1:4),10), b = rep(sample(1:4),10)) kripp.alpha(t(df)) This is the output. Krippendorff's alpha Subjects = 40 Raters = 2 alpha = 0.342 How can I compute the confidence interval here? 回答1: You are right it is connected to bootstrapping. You could

Conditionally colour data points outside of confidence bands in R

风流意气都作罢 提交于 2019-12-31 10:49:26
问题 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 you provide an example please? Example dataset: ## Dataset from http://www.apsnet.org/education/advancedplantpath/topics/RModules/doc1/04_Linear_regression.html ## Disease severity as a function of temperature # Response variable, disease severity

Compute a confidence interval from sample data

两盒软妹~` 提交于 2019-12-27 11:50:41
问题 I have sample data which I would like to compute a confidence interval for, assuming a normal distribution. I have found and installed the numpy and scipy packages and have gotten numpy to return a mean and standard deviation (numpy.mean(data) with data being a list). Any advice on getting a sample confidence interval would be much appreciated. 回答1: import numpy as np import scipy.stats def mean_confidence_interval(data, confidence=0.95): a = 1.0 * np.array(data) n = len(a) m, se = np.mean(a)

Confidence Interval for a Seaborn Boxplot

这一生的挚爱 提交于 2019-12-25 10:06:05
问题 I see that I can set a specific confidence interval on a seaboard point plot https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.pointplot.html however, for the 'notch' attribute on the seaboard box plot there seems to be no flexibility for the user to Specify the CI. Is there a way to do this? What is the confidence level of the default seaborn box plot notch? 回答1: seaborn relies on boxplot provided by matplotlib - see docs. The default is 95%, but here's an example how to

Bootstrapping confidence intervals in R: BCa method and prescribed resamples

只谈情不闲聊 提交于 2019-12-24 16:22:18
问题 I would like to estimate confidence intervals in R using the BCa method (correcting for bias and asymmetric boot distribution). However, my resamples are not ''standard resamples'' but something more complicated and thus I would like to generate them separately and subsequently apply a BCa algorithm. As far as I see there exist the function "BootBCa" as well as the ''boot'' package in R. However, in both cases resamples are automatically generated. Is there any way in R to firstly prescribe