prev-class {prevalence} | R Documentation |
"prev"
The "prev"
class represents output from Bayesian true prevalence
estimation models.
Objects of class "prev"
are created by truePrev
, truePrevMulti
, truePrevMulti2
and truePrevPools
.
Objects of class "prev"
contain the following four slots:
par
:A list of input parameters
model
:The fitted Bayesian model, in BUGS language (S3 class "prevModel"
)
mcmc
:A list, with one element per chain, of the simulated true prevalences, sensitivities and specificities
diagnostics
:A list with elements for the Deviance Information Criterion ($DIC
), the Brooks-Gelman-Rubin statistic ($BGR
), and in the case of truePrevMulti
and truePrevMulti2
, the Bayes-P statistic
($bayesP
)
Brecht Devleesschauwer <brechtdv@gmail.com>
truePrev
, truePrevMulti
, truePrevMulti2
, truePrevPools
show-methods
, print-methods
, summary-methods
, convert-methods
, plot-methods
, plot-methods-coda
## Taenia solium cysticercosis in Nepal
SE <- list(dist = "uniform", min = 0.60, max = 1.00)
SP <- list(dist = "uniform", min = 0.75, max = 1.00)
TP <- truePrev(x = 142, n = 742, SE = SE, SP = SP)
## Summarize estimates per chain
summary(TP)
## Diagnostic plots
par(mfrow = c(2, 2))
plot(TP)
## Generic plots from package coda
par(mfrow = c(1, 1))
densplot(TP)
traceplot(TP)
gelman.plot(TP)
autocorr.plot(TP)
## Use 'slotNames()' to see the slots of object TP
slotNames(TP)
## Every slot can be accessed using the '@' operator
## Use 'str()' to see the structure of each object
str(TP@par) # input parameters
str(TP@model) # fitted model
str(TP@mcmc) # simulated TP, SE, SP
str(TP@diagnostics) # DIC and BGR (and bayesP)
## Each element of TP@mcmc inherits from coda class 'mcmc.list'
## List all available methods for this class
methods(class = "mcmc.list")
## List all available functions in the coda package
library(help = "coda")
## Highest Posterior Density interval, from coda package
coda::HPDinterval(TP@mcmc$TP)