全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
11732 3
2014-10-17
最近看到一篇文章,里面涉及到actual coverage和nominal coverage,并画出了两者之间的qq图(下图)
QQ截图20141017113311.png
我也参考了其他文章,真实覆盖率的算法如下:

QQ图片20141017113724.jpg
不知道,哪位大侠能帮我想想这个算法如何下手?


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-10-17 19:37:16
做模拟的时候你知道真实的参数值,然后比如说你模拟了1000次,算了1000个置信区间,看一下其中多少个包含了真实的参数值就行了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-10-17 21:24:10
suppose the random variables x1,x2,...,xn are a random sample from a N(mu, sigma^2) distribution.

R command:

sample mean of x : mean(x)
standard deviation of x : sd(x)
the 97.5th percentile of the t-distribution with 15 degrees of freedom : qt(0.975, 15)

so, the R script is:

inORnot <- function(alpha, n, mu, sigma) {

  x = rnorm(n, mean = mu, sd = sigma)

  L = mean(x) - qt(1 - alpha / 2, n - 1)*sd(x)/sqrt(n)
  U = mean(x) + qt(1 - alpha / 2, n - 1)*sd(x)/sqrt(n)

  return(L <= mu & U >= mu)

}

tau <- function(alpha, S, n) {

  cum = 0
  for (i in 1:S) cum = cum + inORnot(alpha, n, mu = 0, sigma = 1)
  return(cum / S)

}

> tau(alpha = 0.05, S = 1000, n = 100)
[1] 0.957


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-10-19 10:30:12
meishanjia1900 发表于 2014-10-17 21:24
suppose the random variables x1,x2,...,xn are a random sample from a N(mu, sigma^2) distribution.

...
非常感谢您的回复,谢谢了!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群