R中的boot.ci()函数出错
我试图计算引导置信区间。 这是我的密码R中的boot.ci()函数出错,r,statistics-bootstrap,R,Statistics Bootstrap,我试图计算引导置信区间。 这是我的密码 library(boot) nboot <- 10000 # Number of simulations alpha <- .01 # alpha level n <- 1000 # sample size bootThetaQuantile <- function(x,i) { quantile(x[i], probs=.5) } raw <- rnorm(n,0, 1) # raw data ( theta.boot
library(boot)
nboot <- 10000 # Number of simulations
alpha <- .01 # alpha level
n <- 1000 # sample size
bootThetaQuantile <- function(x,i) {
quantile(x[i], probs=.5)
}
raw <- rnorm(n,0, 1) # raw data
( theta.boot.median <- boot(raw, bootThetaQuantile, R=nboot) )
boot.ci(theta.boot.median, conf=(1-alpha)) #this causes no error
boot.ci(theta.boot.median, conf=(1-alpha), type = "percent") #this causes an error
库(启动)
nboot这是因为您必须使用type='perc'
boot.ci(theta.boot.median, conf=(1-alpha), type = "perc")