TwoDepTestsOnePopNGS: Two dependent tests, one populations and no gold standard

Description Usage Arguments Details Value References Examples

View source: R/TwoDepTestsOnePopNGS.R

Description

2 tests and 1 population ...

Usage

1
2
TwoDepTestsOnePopNGS(dataset, inits, priors, pars, n_iter = 10000,
  n_chains = 3, burn_in = 1000, thin = 1)

Arguments

dataset

list with the population size and test results. The names of these values must be "pop_size" and "t_res" respectively. t_res is a named vector with the number of animals thesting postive in both tests "t1p_t2p", testing positive in the first and negative in the second "t1p_t2n", testing negative in the second and positive in the second "t1n_t2p", and testing positive in both "t1n_t2n".

inits

list with initial conditions for chains. inits must define initial values for pi, se_test1, sp_test1, se_test2 and sp_test2.

priors

vector with the parameters a and b (Beta distribution) for pi, se_test1, sp_test1, se_test2 and sp_test2..

pars

character vector giving the names of parameters to be monitored. It is passed to the variable.names argument of the coda.samples function. In addition to the parameters specified in inits, ... monitored if specified in pars as "app_prev", "ppv" and "npv", respectively.

n_iter

number of iterations to monitor. It is passed to the n.iter argument of the coda.samples function.

n_chains

the number of parallel chains for the model. It is passed to the n.chains argument of the jags.model function.

burn_in

the number of iteration to be discarded. It is passed to the n.iter argument of the update.jags function.

thin

thinning interval for monitors. It is passed to the thin argument of the coda.samples function.

Details

This function creates a text file with the model and it is saved in the working directory.

Value

A list of class mcmc.list.

References

https://cadms.vetmed.ucdavis.edu/diagnostic/software

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Dataset
dataset <- list(pop_size = 214,
                t_res = c(t1p_t2p = 121, t1p_t2_n = 6,
                          t1n_t2_p = 16, t1n_t2n = 71))

# Priors
priors <- c(pi_a = 13.322, pi_b = 6.281,
            se_test1_a = 9.628, se_test1_b = 3.876,
            sp_test1_a = 15.034, sp_test1_b = 2.559,
            se_test2_a = 9.628, se_test2_b = 3.876,
            sp_test2_a = 15.034, sp_test2_b = 2.559)

# Estimates
est <- TwoDepTestsOnePopNGS(dataset = dataset, n_iter = 3e3,
                                 priors = priors, pars = c("se_test1", "se_test2"))

summary(est)

# Diagnostic plots.
library(coda); library(ggmcmc)
gelman.diag(est)
gelman.plot(est)
gg_res <- ggs(est)
ggs_traceplot(gg_res)
ggs_density(gg_res)
ggs_histogram(gg_res, bins = 100)
ggs_compare_partial(gg_res)
ggs_running(gg_res)
ggs_autocorrelation(gg_res)

oswaldosantos/ptb documentation built on May 24, 2019, 5:13 p.m.