csmf.diag {InSilicoVA} | R Documentation |
Convergence test for fitted InSilico model
Description
Produce convergence test for CSMFs from fitted "insilico"
objects.
Usage
csmf.diag(
csmf,
conv.csmf = 0.02,
test = c("gelman", "heidel")[2],
verbose = TRUE,
autoburnin = FALSE,
which.sub = NULL,
...
)
Arguments
csmf |
It could be either fitted |
conv.csmf |
The minimum mean CSMF to be checked. Default to be 0.02, which means any causes with mean CSMF lower than 0.02 will not be tested. |
test |
Type of test. Currently supporting Gelman and Rubin's test
( |
verbose |
Logical indicator to return the test detail instead of one logical outcome for Heidelberger and Welch's test. Default to be TRUE. |
autoburnin |
Logical indicator of whether to omit the first half of the
chain as burn in. Default to be FALSE since |
which.sub |
the name of the sub-population to test when there are multiple in the fitted object. |
... |
Arguments to be passed to heidel.diag or gelman.diag |
Details
The tests are performed using heidel.diag and gelman.diag
functions in coda
package. The function takes either one or a list of
output from insilico
function, or only the iteration by CSMF matrix.
Usually in practice, many causes with very tiny CSMF are hard to converge
based on standard tests, thus it is suggested to check convergence for only
causes with mean CSMF over certain threshold by setting proper
conv.csmf
.
Note for Gelman and Rubin's test, all chains should have the same length. If the chains are sampled with automatically length determination, they might not be comparable by this test.
Author(s)
Zehang Li, Tyler McCormick, Sam Clark
Maintainer: Zehang Li <lizehang@uw.edu>
References
Tyler H. McCormick, Zehang R. Li, Clara Calvert, Amelia C. Crampin, Kathleen Kahn and Samuel J. Clark Probabilistic cause-of-death assignment using verbal autopsies, Journal of the American Statistical Association (2016), 111(515):1036-1049.
Gelman, Andrew, and Donald B. Rubin. Inference from iterative simulation using multiple sequences. Statistical science (1992): 457-472.
Brooks, Stephen P., and Andrew Gelman. General methods for monitoring convergence of iterative simulations. Journal of computational and graphical statistics 7.4 (1998): 434-455.
Heidelberger, Philip, and Peter D. Welch. A spectral method for confidence interval generation and run length control in simulations. Communications of the ACM 24.4 (1981): 233-245.
Heidelberger, Philip, and Peter D. Welch. Simulation run length control in the presence of an initial transient. Operations Research 31.6 (1983): 1109-1144.
Schruben, Lee W. Detecting initialization bias in simulation output. Operations Research 30.3 (1982): 569-590.
See Also
Examples
# load sample data together with sub-population list
data(RandomVA2)
## Not run:
# extract InterVA style input data
data <- RandomVA2
# extract sub-population information.
subpop <- RandomVA2$sex
# run without sub-population
fit1a<- insilico( data, subpop = NULL,
Nsim = 400, burnin = 200, thin = 10 , seed = 1,
auto.length = FALSE)
fit1b<- insilico( data, subpop = NULL,
Nsim = 400, burnin = 200, thin = 10 , seed = 2,
auto.length = FALSE)
fit1c<- insilico( data, subpop = NULL,
Nsim = 400, burnin = 200, thin = 10 , seed = 3,
auto.length = FALSE)
# single chain check
csmf.diag(fit1a)
# multiple chains check
csmf.diag(list(fit1a, fit1b, fit1c), test = "gelman")
# with sub-populations
fit2a<- insilico( data, subpop = subpop,
Nsim = 400, burnin = 200, thin = 10 , seed = 1,
auto.length = FALSE)
fit2b<- insilico( data, subpop = subpop,
Nsim = 400, burnin = 200, thin = 10 , seed = 2,
auto.length = FALSE)
fit2c<- insilico( data, subpop = subpop,
Nsim = 400, burnin = 200, thin = 10 , seed = 3,
auto.length = FALSE)
# single chain check
csmf.diag(fit2a)
# multiple chains check
csmf.diag(list(fit2a, fit2b, fit2c), test = "gelman", which.sub = "Men")
## End(Not run)