EpiBayes_ns(H, k, n, seasons, reps, MCMCreps, poi = "tau", y = NULL, mumodes = matrix(c(0.5, 0.7, 0.5, 0.7, 0.02, 0.5, 0.02, 0.5), 4, 2, byrow = TRUE), pi.thresh = 0.02, tau.thresh = 0.05, gam.thresh = 0.1, tau.T = 0, poi.lb = 0, poi.ub = 1, p1 = 0.95, psi = 4, omegaparm = c(100, 1), gamparm = c(100, 1), tauparm = c(1, 1), etaparm = c(100, 6), thetaparm = c(100, 6), burnin = 1000)
H
x 1).sum(k)
x 1).sum(k)
x 1).gam
) or the cluster-level prevalence (tau
), indicating which variable
with which to compute the simulation output p2.tilde
, p4.tilde
, and
p6.tilde
. Character scalar.NULL
). Integer matrix (reps
x sum(k)
).poi
prevalences
to show ability to capture poi
with certain probability. Real scalars.poi
prevalence is below / above the thresholds
pi.thresh
or tau.thresh
or within specified bounds. Real scalar.omega
, which
is the probability that the disease is in the region. Real vector (2 x 1).gam
, which
is the subzone-level prevalence (or the prevalence among subzones). Real
vector (2 x 1).tau
, which is the
cluster-level prevalence (or the prevalence among clusters). Real vector (2 x 1).eta
, which is the
sensitivity of the diagnostic test. Real vector (2 x 1).theta
, which is
the specificity of the diagnostic test. Real vector (2 x 1).EpiBayes_s
. It returns enough to perform inference
but not to perform diagnostics for the model fit nor MCMC convergence.
If this is the first time running the model, we recommend that the user utilizes
the function EpiBayes_ns
and diagnose issues before continuing with
this 'no storage' model.
Nevertheless, below are the outputs of this model.
p2.tilde |
Real scalar |
Proportion of simulated data sets that result in the probability of poi prevalence below poi.thresh with probability p1 |
p4.tilde |
Real scalar | Proportion of simulated data sets that result in the probability of poi prevalence above poi.thresh with probability p1 |
p6.tilde |
Real scalar |
Proportion of simulated data sets that result in the probability of poi prevalence between poi.lb and poi.ub with probability p1 |
taumat |
Real array (reps x H x MCMCreps ) |
Posterior distributions of the cluster-level prevalence for all simulated data sets (i.e., reps ) |
gammat |
Real matrix (reps x MCMCreps ) |
Posterior distribution of the subzone-level prevalence |
ForOthers |
Various other data not intended to be used by the user, but used to pass information on to the plot , summary , and print methods |
taumat
, can be manipulated after it is
returned with the coda package after it is converted to an mcmc
object.
Parameter | (3-level) Description |
(2-level) Description |
omega |
Probability of disease being in the region. | Not used. |
gam |
Subzone-level (between-subzone) prevalence. |
Probability of disease being in the region. |
z.gam |
Subzone-level (between-subzone) prevalence latent indicator variable. | Not used. |
tau |
Cluster-level (between-cluster) prevalence. |
Same as (3-level). |
z.tau |
Cluster-level (between-cluster) prevalence latent indicator variable. | Same as (3-level). |
pi |
Subject-level (within-cluster) prevalence. |
Same as (3-level). |
z.pi |
Subject-level (within-cluster) prevalence latent indicator variable. | Same as (3-level). |
mu |
Mean prevalence among infected clusters. |
Same as (3-level). |
psi |
(Related to) variability of prevalence among infected clusters (inversely related so higher psi -> lower variance of prevalences among diseased clusters). |
Same as (3-level). |
eta |
Diagnostic test sensitivity. |
Same as (3-level). |
theta |
Diagnostic test specificity. | Same as (3-level). |
c1 |
Latent count of true positive diagnostic test results. |
Same as (3-level). |
c2 |
Latent count of true negative diagnostic test results. | Same as (3-level). |
taumat
instead of plain tau
to denote that that variable is a
matrix (or, more generally an array) of values.EpiBayes_s
except
it doesn't store the posterior distributions of all of the parameters in the model
and hence is a bit quicker to run.
This model is a Bayesian hierarchical model that serves two main purposes:
The posterior distributions are avaialable for a particular parameter, say tau, by
typing name_of_your_model$taumat
.
Note: be careful about the size of the taumat
matrix you are calling. The
last index of any of the variables from above is the MCMC replications and so we
would typically always omit the last index when looking at any particular variable.
tau
) for the first replication in the first subzone, we
will note that taumat is a matrix with the first dimension indexed by
replication, the second dimension indexed by subzone, and the third dimension
indexed by MCMC replications. Then, we will type something like
name_of_your_model$taumat[1, 1, ]
to visually
inspect the posterior distribution in the form of a vector. For the second
replication in the fourth subzone, we can type
name_of_your_model$taumat[2, 4, ]
, and so forth.
Then, we can make histograms of these distributions if we so desire by the
following code:
hist(name_of_your_model$taumat[1, 1, ], col = "cyan");box("plot")
.
To observe a trace plot, we can type:
plot(name_of_your_model$taumat[1, 1, ], type = "l")
for all of the MCMC replications and we can look
at the trace plot after a burnin of 1000 iterations by typing:
plot(name_of_your_model$taumat[1, 1, -c(1:1000)], type ="l")
.
EpiBayes_s
stores more output so the user may check
diagnostics, but is understandably slower to execute.
testrun_nostorage = EpiBayes_ns(
H = 2,
k = rep(30, 2),
n = rep(rep(150, 30), 2),
seasons = rep(c(1, 2, 3, 4), each = 15),
reps = 10,
MCMCreps = 10,
poi = "tau",
y = NULL,
mumodes = matrix(c(
0.50, 0.70,
0.50, 0.70,
0.02, 0.50,
0.02, 0.50
), 4, 2, byrow = TRUE
),
pi.thresh = 0.05,
tau.thresh = 0.02,
gam.thresh = 0.10,
tau.T = 0,
poi.lb = 0,
poi.ub = 1,
p1 = 0.95,
psi = 4,
omegaparm = c(100, 1),
gamparm = c(100, 1),
tauparm = c(1, 1),
etaparm = c(100, 6),
thetaparm = c(100, 6),
burnin = 1
)
testrun_nostorage
print(testrun_nostorage)
testrun_nostoragesummary = summary(testrun_nostorage, prob = 0.90, n.output = 5)
testrun_nostoragesummary
plot(testrun_nostorage$taumat[1, 1, ], type = "l")
plot(testrun_nostorage$gammat[1, ], type = "l")
## Can't look at any other posterior distributions other than gam and tau
## Not run:
# plot(testrun_nostorage$pimat[1, 1, ], type = "l")
# plot(testrun_nostorage$omegamat[1, ], type = "l")
# ## End(Not run)
Run the code above in your browser using DataLab