How to calculate confidence for non standard bands?
So I have a dataset : dt<-c(1106,1402, 827, 781,876, 1134,1014, 964, 848, 814, 772, 912, 923, 996, 569, 774, 1389, 900)
lets assume a normal curve and running t.test(dt)
I get
One Sample t-test
data: dt t = 19.057, df = 17, p-value = 6.579e-13 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 839.9344 1049.0656 sample estimates: mean of x 944.5
Which is all standard fare for 95% confidence interval.
But what I'd like to find is what is the confidence in a specific range like from 850 to 900. Because I want to know the probability that the next datapoint will fall between 850 and 900. Which package::function can do this?
I don't know of a built-in function but it's not too too hard to compute using pt()
, the cumulative distribution function for Student's t:
dd <- c(1106,1402, 827, 781,876, 1134,1014,
964, 848, 814, 772, 912, 923, 996, 569, 774, 1389, 900)
m <- mean(dd)
s <- sd(dd)
Now we (1) convert the desired range to "t statistic" scale (subtract mean and divide by sd) and (2) compute the cumulative probability of x<lower_bound
and x<upper_bound
probs <- pt((c(850,900)-m)/s,df=length(dd)-1)
The probability of a value falling in the range is the difference of these two values.
diff(probs) ## 0.08805229
链接地址: http://www.djcxy.com/p/57764.html
上一篇: 我如何评估我的技术?
下一篇: 如何计算非标准频带的置信度?