Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.atwins

Plot results of a twins model fit


Description

Plot results of fitting a twins model using MCMC output. Plots similar to those in the Held et al. (2006) paper are generated

Usage

## S3 method for class 'atwins'
plot(x, which=c(1,4,6,7), ask=TRUE, ...)

Arguments

x

An object of class atwins.

which

a vector containing the different plot types to show

1

A plot of the observed time series Z is shown together with posterior means for the number of endemic cases (X) and number of epidemic cases (Y).

2

This plot shows trace plots of the gamma parameters over all MCMC samples.

3

This shows a trace plot of psi, which controls the overdispersion in the model.

4

Autocorrelation functions for K and psi are shown in order to judge whether the MCMC sampler has converged.

5

Shows a plot of the posterior mean of the seasonal model nu[t] together with 95% credibility intervals based on the quantiles of the posterior.

6

Histograms illustrating the posterior density for K and psi. The first one corresponds to Fig. 4(f) in the paper.

7

Histograms illustrating the predictive posterior density for the next observed number of cases Z[n+1]. Compare with Fig.5 in the paper.

ask

Boolean indicating whether to ask for a newline before showing the next plot.

...

Additional control for the plots, which are currently ignored.

Details

For details see the plots in the paper. Basically MCMC output is visualized. This function is together with algo.twins still experimental.

Value

This function does not return anything.

Author(s)

M. Hofmann and M. Höhle

References

Held, L., Hofmann, M., Höhle, M. and Schmid V. (2006) A two-component model for counts of infectious diseases, Biostatistics, 7, pp. 422–437.

See Also

Examples

## Not run: 
#Apparently, the algo.atwins can crash on some LINUX systems
#thus for now the example section is commented

#Load the data used in the Held et al. (2006) paper
data("hepatitisA")

#Fix seed - this is used for the MCMC samplers in twins
set.seed(123)

#Call algorithm and save result
otwins <- algo.twins(hepatitisA)

#This shows the entire output
plot(otwins,which=c(1,2),ask=FALSE)

## End(Not run)

surveillance

Temporal and Spatio-Temporal Modeling and Monitoring of Epidemic Phenomena

v1.19.1
GPL-2
Authors
Michael H<f6>hle [aut, ths] (<https://orcid.org/0000-0002-0423-6702>), Sebastian Meyer [aut, cre] (<https://orcid.org/0000-0002-1791-9449>), Michaela Paul [aut], Leonhard Held [ctb, ths], Howard Burkom [ctb], Thais Correa [ctb], Mathias Hofmann [ctb], Christian Lang [ctb], Juliane Manitz [ctb], Andrea Riebler [ctb], Daniel Saban<e9>s Bov<e9> [ctb], Ma<eb>lle Salmon [ctb], Dirk Schumacher [ctb], Stefan Steiner [ctb], Mikko Virtanen [ctb], Wei Wei [ctb], Valentin Wimmer [ctb], R Core Team [ctb] (A few code segments are modified versions of code from base R)
Initial release
2021-03-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.