# KeepNotes blog

Stay hungry, Stay Foolish.

0%

• 标准正态分布的CI
• 针对小样本正态分布的Wilson score interval（使用的比较多。。。）
• Wilson的变形Transformed Wilson
• Jackknife（刀切法）
• Bootstrap（自助法，使用的也比较多。。。）

Precison assessment in tumor diagnosis (Immunological method)文章中提到APA/ANA等acceptance criteria会使用bootstrap来计算CI（还有如：Passing-block回归系数、样本量过少的时候、reference interval建立等）

• 标准正态Bootstrap置信区间
• 基本Bootstrap置信区间
• Bootstrap百分位数（percentile）置信区间
• Bootstrap t置信区间

``````apa_cal <- function(df, ind){
df <- as.data.frame(df)
a <- sum(df[ind, "status"] == "high" &  df[ind, "STATUS2"] == "high")
b <- sum(df[ind, "status"] == "high" &  df[ind, "STATUS2"] == "low")
c <- sum(df[ind, "status"] == "low" &  df[ind, "STATUS2"] == "high")
d <- sum(df[ind, "status"] == "low" &  df[ind, "STATUS2"] == "low")

tb <- matrix(c(a, c, b, d), nrow = 2)
opa <- (tb[1,1] + tb[2,2]) / (tb[1,1] + tb[1,2] + tb[2,1] + tb[2,2]) * 100
apa <- 2 * tb[1,1] / (tb[1,1] + tb[2,1] + tb[1,1] + tb[1,2]) * 100
ana <- 2 * tb[2,2] / (tb[2,2] + tb[1,2] + tb[2,2] + tb[2,1]) * 100
return(c(opa, apa, ana))
}``````

``````set.seed(12345)
bot <- boot(data = dat, statistic = apa_cal, R = 2000)``````

``````bci1<- boot.ci(bot, conf = 0.95, type = c("perc"), index = 1)
ci1 <- c(bci1\$percent[,4], bci1\$percent[,5])``````

Bootstrap Confidence Intervals for more than one statistics through boot.ci function