参考论文
[1]蒋福坤,刘正春.指数分布参数的区间估计和假设检验[J].嘉兴学院学报,2004(03):13-15.
代码
# 单参数指数分布的1-alpha 的置信区间
library(VGAM)
#下面的rexp是VGAM包里的
expci <- function(n,scale,shape,alpha){
x <- rexp(n,rate = 1/shape)
xbar <- mean(x)
expcimin <-qgamma(alpha/2,scale=1,shape=n) /(n*xbar)
expcimax <-qgamma(1-alpha/2,scale=1,shape=n) /(n*xbar)
return(c(expcimin,expcimax))
}
expci(1000,0,1,0.05)
# 双参数指数分布的1-alpha 的置信区间
library(VGAM)
expoci <- function(n,location,scale,alpha){
y <- rlaplace(n,location = location,scale = scale)
x <- y[which(y>location)]
xbar <- mean(x)
xmin <- min(x)
mucimin <- xmin-(xbar-xmin)/(n-1)*qf(1-alpha/2,2,2*(n-1))
mucimax <- xmin+(xbar-xmin)/(n-1)*qf(alpha/2,2,2*(n-1))
sigmamin <- n*(xbar-xmin)/qgamma(1-alpha/2,n-1,1)
sigmamax <- n*(xbar-xmin)/qgamma(alpha/2,n-1,1)
return(c(mucimin,mucimax,sigmamin,sigmamax))
}
expoci(1000,2,1,0.05)