如何找到95%的可信区间?
我正在尝试计算以下后验分布的95%可信区间。我找不到R中的函数,但是下面的方法正确吗? x <- seq(0.4,12,0.4) px <- c(0,0, 0, 0, 0, 0, 0.0002, 0.0037, 0.018, 0.06, 0.22 ,0.43, 0.64,0.7579, 0.7870, 0.72, 0.555, 0.37, 0.24, 0.11, 0.07, 0.02, 0.009, 0.005, 0.0001, 0,0.0002, 0, 0, 0) plot(x,px, type="l") mm <- sum(x*px)/sum(px) var <- (sum((x)^2*px)/sum(px)) - (mm^2) cat("95% credible interval: ", round(mm -1.96*sqrt(var),3), "-", …