rriskBayes(rriskBayes)
rriskBayes()所属R语言包:rriskBayes
Predefined Bayes models fitted with Markov chain Monte Carlo (MCMC) (related to the 'rrisk' project).
马尔可夫链蒙特卡罗(MCMC)(与“rrisk”项目)配有预定义的贝叶斯模型。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This packages provides a collection of functions for fitting Bayesian models (related to the rrisk project). The functions can be used as stand-alone applications or launched during an rrisk session. <br> The following Bayesian models are implemented in this
这个包提供了一系列的功能贝叶斯模型拟合(rrisk项目)。该功能可以被用来作为独立的应用程序或启动过程中rrisk届。参考下面的贝叶斯模型中实现
PEM prevalence estimation
PEM患病率估计
ZIP estimation of a zero
ZIP估计的零
Details
详细信息----------Details----------
Collection of functions for fitting Bayesian models. The functions can be used as stand-alone application or launched during an 'rrisk' session.
贝叶斯模型拟合功能的集合。该功能可以被用来作为独立的应用程序或一个的“rrisk”会话期间推出。
This package is a part of the rrisk project and contains functions for fitting Bayesian models using the package BRugs. This package does not depend on the whole rrisk project and can be used separately. The rrisk project can be downloaded from http://www.bfr.bund.de/cd/52158.
这个包是rrisk项目的一部分,和包含配件贝叶斯模型使用包BRugs的功能。这个包不依赖于整个rrisk项目,可以单独使用。 rrisk项目可以下载从http://www.bfr.bund.de/cd/52158。
注意----------Note----------
See also the documentation to the <acronym>R</acronym>-package BRugs.
另请参阅文档的<acronym> R </首字母缩写>包BRugs。
(作者)----------Author(s)----------
Natalia Belgorodski <a href="mailto:belgorodski@stat-up.de">belgorodski@stat-up.de</a>
(<acronym><span class="acronym">STAT-UP</span></acronym> Statistical Consulting), <br> Matthias
Greiner <a href="mailto:matthias.greiner@bfr.bund.de">matthias.greiner@bfr.bund.de</a> (Federal
Institute for Risk Assessment, Germany), <br> Alexander
Engelhardt <a href="mailto:engelhardt@stat-up.de">engelhardt@stat-up.de</a> (<acronym><span class="acronym">STAT-UP</span></acronym>
Statistical Consulting)
实例----------Examples----------
#------------------------------------------[------------------------------------------]
# Example of PEM model (k>1)[PEM模型的例子(K> 1)]
#------------------------------------------[------------------------------------------]
pi <- 0.01
se <- 0.96
se.n <- 1000
sp <- 0.99
sp.n <- 1000
n <- sample(10:1000,1,replace=TRUE) # stochatsic sample size[stochatsic样本量]
k <- sample(5:50,1,replace=FALSE) # stochastic pool size[随机池的大小]
# Parameters for beta priors[测试先验的参数]
se.a <- se.n*se+1
se.b <- se.n*(1-se)+1
sp.a <- sp.n*sp+1
sp.b <- sp.n*(1-sp)+1
# Random number of positive pools (x) considering uncertainty of se and sp[考虑不确定性的SE和SP的积极池的随机数(X)]
ap <- pi*se + (1-pi)*(1-sp)
p.pos <- 1-(1-ap)^k
x <- rbinom(1,prob=p.pos,size=n)
# Estimate using Bayes model at individual level[在个人层面,估计使用贝叶斯模型]
resPEM1 <- rrisk.BayesPEM(x=x, n=n,k=k,
prior.pi=c(1,1),prior.se=c(se.a,se.b),prior.sp=c(sp.a,sp.b),
misclass="individual")
resPEM1@results
# Estimate using Bayes model at pool level[在池级别的,估计使用贝叶斯模型]
resPEM2 <- rrisk.BayesPEM(x=x, n=n,k=k,
prior.pi=c(1,1),prior.se=c(se.a,se.b),prior.sp=c(sp.a,sp.b),
misclass="pool")
resPEM2@results
# Estimate using Bayes model compared[估计使用贝叶斯模型比较]
resPEM3 <- rrisk.BayesPEM(x=x, n=n,k=k,
prior.pi=c(1,1),prior.se=c(se.a,se.b),prior.sp=c(sp.a,sp.b),
misclass="compare")
resPEM3@results
#------------------------------------------[------------------------------------------]
# Example of PEM model (k=1)[PEM模型(k = 1时)的实施例的]
#------------------------------------------[------------------------------------------]
# informative priors -> convergence is o.k.[先验信息 - >收敛O.K.]
resPEM4<-rrisk.BayesPEM(x=2,n=10,k=1,prior.se=c(12,22),
prior.sp=c(22,55),prior.pi=c(1,1))
resPEM4@results
# non-informative priors -> convergence of 'pi' is not o.k.[非先验信息 - >收敛“PI”是不是ok]
resPEM5<-rrisk.BayesPEM(x=2,n=10,k=1,prior.se=c(1,1),
prior.sp=c(1,1),prior.pi=c(1,1))
resPEM5@results
# informative priors -> convergence is o.k., without invoking graphical[先验信息 - >收敛是确定的,而无需调用图形]
# diagnostic interface[诊断接口]
resPEM6<-rrisk.BayesPEM(x=2,n=10,k=1,prior.se=c(12,22),
prior.sp=c(22,55),prior.pi=c(1,1))
resPEM6@results
#------------------------------------------[------------------------------------------]
# Example of ZIP model[ZIP模式的例子]
#------------------------------------------[------------------------------------------]
# generate ZIP data[生成ZIP数据]
pi<-0.01
n<-200
lambda<-3.5
zip.data<-rep(0,n)
zip.data[sample(1:n,n*pi,replace=FALSE)]<-rpois(n*pi,lambda=lambda)
# estimate using Bayes model for zero inflated data[零膨胀的数据,估计使用贝叶斯模型]
resZIP1<-rrisk.BayesZIP(data=zip.data, prior.lambda=c(0,100),prior.pi=c(1,1),
burn=100,update=1000)
resZIP1@results
# estimate using Bayes model for zero inflated data without invoking[估计使用贝叶斯模型的零膨胀的数据,而不调用]
# graphical diagnostic interface[图形诊断接口]
rrisk.BayesZIP(data=zip.data, prior.lambda=c(0,100),prior.pi=c(1,1),
burn=100,update=1000,simulation=TRUE)
# compare with naive results ignoring ZIP model[比较天真的结果忽略ZIP模型]
pi.crude <- sum(zip.data>0)/n
lambda.crude <- mean(zip.data)
print(pi.crude)
print(lambda.crude)
resZIP1@results
#------------------------------------------[------------------------------------------]
# Examples of GUI functions[GUI函数的例子]
#------------------------------------------[------------------------------------------]
data <- rpois(30, 4)
res<-ZIPGUI(data)
mod <- PEMGUI()
#-----------------------------------------------------[-------------------------------------------------- ---]
# Creating an instance of the 'bayesmodelClass'[创建一个实例的“bayesmodelClass]
#-----------------------------------------------------[-------------------------------------------------- ---]
new("bayesmodelClass")
# end of donttest[年底donttest]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|