confidence-interval

Error in bootstrapping: Error in if (const(t, min(1e-08, mean(t, na.rm = TRUE)/1e 06)))

别来无恙 提交于 2019-12-06 10:45:32
问题 I get the following error message when calculating bootstrap confidence intervals with the "boot" package: Error in if (const(t, min(1e-08, mean(t, na.rm = TRUE)/1e+06))) { : Missing Value, where TRUE/FALSE is necessary This error occurs only if I want to calculate bootstrap confidence intervals for spearman correlation coefficients across countries of a specific variable and is thus not easily reproduced. For many variables the code runs nicely, but for this specific one I obtain the above

How to get confidence interval for smooth.spline?

孤者浪人 提交于 2019-12-06 08:44:35
问题 I have used smooth.spline to estimate a cubic spline for my data. But when I calculate the 90% point-wise confidence interval using equation, the results seems to be a little bit off. Can someone please tell me if I did it wrongly? I am just wondering if there is a function that can automatically calculate a point-wise interval band associated with smooth.spline function. boneMaleSmooth = smooth.spline( bone[males,"age"], bone[males,"spnbmd"], cv=FALSE) error90_male = qnorm(.95)*sd

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

半腔热情 提交于 2019-12-06 06:36:23
问题 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 this confidence assumed to be heteroskedastic? 回答1: To produce confidence intervals for xgboost model you should train several models (you can use bagging for this). Each model will produce a response for test sample - all responses will form a

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

有些话、适合烂在心里 提交于 2019-12-05 15:25:47
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 would be great if anyone know how it can be done in python. Sample picture of expected output: This was bugging me, so I adopted an answer from PCA and Hotelling's T^2 for confidence intervall in R in python (and using some source code from the ggbiplot R package) from sklearn import decomposition from sklearn.preprocessing import StandardScaler

Running 'prop.test' multiple times in R

百般思念 提交于 2019-12-05 13:16:49
I have some data showing a long list of regions, the population of each region and the number of people in each region with a certain disease. I'm trying to show the confidence intervals for each proportion (but I'm not testing whether the proportions are statistically different). One approach is to manually calculate the standard errors and confidence intervals but I'd like to use a built-in tool like prop.test, because it has some useful options. However, when I use prop.test with vectors, it runs a chi-square test across all the proportions. I've solved this with a while loop (see dummy

Adding confidence intervals to a qq plot?

筅森魡賤 提交于 2019-12-05 03:31:05
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 391 13.5 1.41 208 2.37 166 3.42] I would now like to plot 95% confidence intervals to check which data

Two Factor ANOVA Errorbar plot in R

梦想与她 提交于 2019-12-05 02:11:33
问题 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 is on the statistics, not the programming. Nevertheless, we haven't found a very good way of generating an errorbar plot in R for a two factor ANOVA design. We're using the ggplot2 package to make the plot, and while it does have a built-in stat

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

走远了吗. 提交于 2019-12-04 23:00:53
问题 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 model): library(quantreg) LM<-lm(mpg~disp, data = mtcars) QR<-rq(mpg~disp, data = mtcars, tau=0.5) I am able to get 95% confidence intervals for the linear model using the confint function: confint(LM) When I use quantile regression I understand that the following code produces

R - Confidence bands for exponential model (nls) in basic graphics

蓝咒 提交于 2019-12-04 19:23:22
I'm trying to plot a exponential curve (nls object), and its confidence bands. I could easily did in ggplot following the Ben Bolker reply in this post . But I'd like to plot it in the basic graphics style, (also with the shaped polygon) df <- structure(list(x = c(0.53, 0.2, 0.25, 0.36, 0.46, 0.5, 0.14, 0.42, 0.53, 0.59, 0.58, 0.54, 0.2, 0.25, 0.37, 0.47, 0.5, 0.14, 0.42, 0.53, 0.59, 0.58, 0.5, 0.16, 0.21, 0.33, 0.43, 0.46, 0.1, 0.38, 0.49, 0.55, 0.54), y = c(63, 10, 15, 26, 34, 32, 16, 31,26, 37, 50, 37, 7, 22, 13, 21, 43, 22, 41, 43, 26, 53, 45, 7, 12, 25, 23, 31, 19, 37, 24, 50, 40)),

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

﹥>﹥吖頭↗ 提交于 2019-12-04 18:23:58
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? You are right it is connected to bootstrapping. You could compute the confidence interval the following way: library(irr) library(boot) alpha.boot <- function(d,w) {