confidence-interval

Java calculate confidence interval

跟風遠走 提交于 2019-12-11 09:54:28
问题 I'm looking for some method that takes or does not take parameters for calculate confidence interval. I don't want the apache methods, just a simple method or som type of code that does this. 回答1: here is you go this is the code calculate Confidence Interval /** * * @author alaaabuzaghleh */ public class TestCI { public static void main(String[] args) { int maximumNumber = 100000; int num = 0; double[] data = new double[maximumNumber]; // first pass: read in data, compute sample mean double

Non-parametric bootstrapping on the highest level of clustered data using boot() function from {boot} in R

十年热恋 提交于 2019-12-11 04:03:49
问题 I have two-level hierarchical data and I'm trying to perform non-parametric bootstrap sampling on the highest level, i.e., randomly sampling the highest-level clusters with replacement while keeping the original within-cluster data. I want to achieve this using the boot() function in the {boot} package, for the reason that I then would like to build BCa confidence intervals using boot.ci() which requires a boot object. Here follows my unlucky attempt - running a debug on the boot call showed

Pandas, compute many means with bootstrap confidence intervals for plotting

依然范特西╮ 提交于 2019-12-11 03:34:13
问题 I want to compute means with bootstrap confidence intervals for some subsets of a dataframe; the ultimate goal is to produce bar graphs of the means with bootstrap confidence intervals as the error bars. My data frame looks like this: ATG12 Norm ATG5 Norm ATG7 Norm Cancer Stage 5.55 4.99 8.99 IIA 4.87 5.77 8.88 IIA 5.98 7.88 8.34 IIC The subsets I'm interested in are every combination of Norm columns and cancer stage. I've managed to produce a table of means using: df.groupby('Cancer Stage')[

Adding Confidence Intervals to plotted ACF in ggplot2

天涯浪子 提交于 2019-12-11 00:28:09
问题 I plan to build a customized ACF and PACF plot for a simulated time series ts <- arima.sim(n=5300,list(order=c(2,0,1), ar=c(0.4,0.3), ma=-0.2)) Below are the codes I wrote to produce the plot through ggplot2 : library(gridExtra) theme_setting <- theme( panel.background = element_blank(), panel.grid.major.y = element_line(color="grey90", size=0.5), panel.grid.major.x = element_blank(), panel.border = element_rect(fill=NA, color="grey20"), axis.text = element_text(family="Times"), axis.title =

Add confidence intervals to GLM allEffects plot

梦想与她 提交于 2019-12-10 23:58:54
问题 I need to add 95% confidence intervals on my glm plot. When I do multiline=T (because I need my 2 treatments on the same plot, so I did this), the intervals disappear. How can I get them back? This is what I have now: plot(allEffects(fit1), ylab= "Age of onset of foraging", main="", type="rescale", multiline=T, rescale.axis=F) as data I have -RFID is the technique to identify the honeybees and follow their movements; 2 treatments: control and a pathogen-treatment; "first.trip" - days until

How to extract attributes values from svyciprop object?

好久不见. 提交于 2019-12-10 17:29:45
问题 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 <- svyciprop(~I(ell==0), dclus1, method="li") printing prop.ci Yields: > prop.ci 2.5% 97.5% I(ell == 0) 0.021858 0.000664 0.11 str(prop.ci) > str(prop.ci) Class 'svyciprop' atomic [1:1] 0.0219 ..- attr(*, "var")= num [1, 1] 0.000512 .. ..- attr(*,

Bootstrap Confidence Intervals in R

孤街醉人 提交于 2019-12-09 07:13:30
问题 I am a new R user, and am having trouble using the boot package. All I want to do is use bootstrapping to produce confidence intervals around a mean for a vector of numbers, such as: x <- rnorm(100, 1, .5) Any tips? 回答1: Doesn't the following suffice? library(boot) x <- rnorm(100, 1, .5) b <- boot(x, function(u,i) mean(u[i]), R = 999) boot.ci(b, type = c("norm", "basic", "perc")) 来源: https://stackoverflow.com/questions/9304582/bootstrap-confidence-intervals-in-r

Simulation for Confidence interval in R

旧巷老猫 提交于 2019-12-08 08:39:27
问题 I have an R function that provides the 95% confidence Interval for the ncp (non-centrality parameter) of a t distribution. Via simulation in R, is it possible to show that in the long-run the CIs from this R function capture a given TRUE ncp (here "2" same as input t ) 95% of the time? (I appreciate any ideas as to how to do this) CI.ncp <- function(t, N){ f <- function (ncp, alpha, q, df) { abs(suppressWarnings(pt(q = t, df = N - 1, ncp, lower.tail = FALSE)) - alpha) } sapply(c(0.025, 0.975)

Running 'prop.test' multiple times in R

Deadly 提交于 2019-12-07 10:53:44
问题 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,

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

放肆的年华 提交于 2019-12-06 14:05:15
问题 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,