累积分布函数的贝叶斯置信限

时间:2016-12-01 09:05:04

标签: r bootstrapping bayesian mcmc weibull

我使用Metropolis-Hastings方法将贝叶斯方法应用于一组高度删失的失败数据,现在我从边际后验分布中得到参数值的样本。使用的故障模型是Weibull分布。任何人都可以请帮助我使用贝叶斯方法拟合cdf的逐点置信度限制吗?或者有没有任何方法来计算类似于最大似然置信限的cdf的贝叶斯逐点置信限制。

我可以使用Weibull参数的模拟后验值,并使用类似于bootstrap采样的模拟方法来计算置信限。该方法是否为cdf提供了贝叶斯置信限制?

我用来生成后验样本的R代码如下。

require (MHadaptive)
require (SPREDA)
require (rootSolve)
bearing_cage <- rep (c (50,  150, 230, 250, 334, 350, 423, 450, 550, 650,
            750, 850, 950, 990, 1009, 1050, 1150, 1250, 1350, 
            1450, 1510, 1550, 1650, 1850, 2050), times = c (288,
            148, 1, 124, 1, 111, 1, 106, 99, 110, 114, 119, 127,
            1, 1, 123, 93, 47, 41, 27, 1, 11, 6, 1, 2))

delta <- rep (c(0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 
          0, 0, 1, 0, 0, 0, 0), times = c (288, 148, 1, 124, 1, 
          111, 1, 106, 99, 110, 114, 119, 127, 1, 1, 123, 93, 
          47, 41, 27, 1, 11, 6, 1, 2))

# Define the Bayesian model
bay_mod <- function (theta){
  mu <- theta[1] #location
sigma <- theta[2] #scale
z <- (log (bearing_cage) - mu) / sigma

log_likelihood <- sum (log ((dsev(z)/(sigma*bearing_cage)))*delta) + 
                sum ((1 - delta)*log (1 - psev (z)))
prior <- joint_prior(theta)
return (log_likelihood + prior)
}

# Derive the joint prior for Weibull parameters
joint_prior <- function (theta){

mu <- theta[1] #location
sigma <- theta[2] #scale
joint <- (1 / log (5000/100))*(dnorm ((log(sigma) + 1.151)/.178)/(sigma*.178))
return (log (joint))
}

mcmc_bearingcage <- Metro_Hastings (bay_mod, pars = c (10, 0.5), 
                                par_names = c ("mu", "sigma"))
mcmc_bearingcage <- Metro_Hastings (bay_mod, pars = c (10, 0.5), prop_sigma = mcmc_bearingcage$prop_sigma,
                                par_names = c ("mu", "sigma"))
mcmc_bearingcage <- mcmc_thin(mcmc_bearingcage)


plotMH (mcmc_bearingcage, correlogram = TRUE)

# Bayesian credible intervals for the Weibull parameters
bayesian_int <- BCI (mcmc_bearingcage, interval = c(0.025, 0.975))

提前致谢!!

0 个答案:

没有答案