e0.DLcurve.plot | R Documentation |

The functions plot the posterior distribution of the double logistic function used in the simulation, including their median and given probability intervals.

e0.DLcurve.plot(mcmc.list, country, burnin = NULL, pi = 80, e0.lim = NULL, nr.curves = 20, predictive.distr = FALSE, ylim = NULL, xlab = "e(0)", ylab = "5-year gains", main = NULL, show.legend = TRUE, col = c('black', 'red', "#00000020"), ...) e0.DLcurve.plot.all(mcmc.list = NULL, sim.dir = NULL, output.dir = file.path(getwd(), "DLcurves"), output.type = "png", burnin = NULL, verbose = FALSE, ...) e0.parDL.plot(mcmc.set, country = NULL, burnin = NULL, lty = 2, ann = TRUE, ...) e0.world.dlcurves(x, mcmc.list, burnin = NULL, ...) e0.country.dlcurves(x, mcmc.list, country, burnin = NULL, ...)

`mcmc.list` |
List of |

`mcmc.set` |
Object of class |

`country` |
Name or numerical code of a country. It can also be given as ISO-2 or ISO-3 characters. |

`burnin` |
Number of iterations to be discarded from the beginning of parameter traces. |

`pi` |
Probability interval. It can be a single number or an array. |

`e0.lim` |
It can be a tuple of the minimum and maximum life expectancy to be shown in the plot. If |

`nr.curves` |
Number of curves to be plotted. If |

`predictive.distr` |
Logical. If |

`ylim, xlab, ylab, main, lty` |
Graphical parameters passed to the |

`show.legend` |
Logical determining if the legend should be shown. |

`col` |
Vector of colors in this order: 1. observed data points, 2. quantiles, 3. trajectories |

`...` |
Additional graphical parameters. In addition, any arguments from |

`sim.dir` |
Directory with the simulation results. Only relevant, if |

`output.dir` |
Directory into which resulting graphs are stored. |

`output.type` |
Type of the resulting files. It can be “png”, “pdf”, “jpeg”, “bmp”, “tiff”, or “postscript”. |

`verbose` |
Logical switching log messages on and off. |

`x` |
e0 values for which the double logistic should be computed. |

`ann` |
Logical if parameters should be annotated. |

`e0.DLcurve.plot`

plots double logistic curves for the given country. `e0.DLcurve.plot.all`

creates such plots for all countries and stores them in `output.dir`

. Parameters passed to the double logistic function are either thinned traces created by the `e0.predict`

function (if `mcmc.list`

is an object of class `bayesLife.prediction`

), or they are selected by equal spacing from the MCMC traces. In the former case, `burnin`

is set automatically; in the latter case, `burnin`

defaults to 0 since such object has already been “burned”. If `nr.curves`

is smaller than 2000, the median and probability intervals are computed on a sample of 2000 equally spaced data points, otherwise on all plotted curves.

Function `e0.parDL.plot`

draws the means of the DL parameters as vertical and horizontal lines. The lines are added to the current graphical device and annotated if `ann`

is `TRUE`

. If country is `NULL`

, the mean of world parameters are drawn.

Function `e0.world.dlcurves`

returns the DL curves of the hierarchical distribution. Function `e0.country.dlcurves`

returns DL curves for a given country. If `mcmc.list`

is a prediction object, `burnin`

should not be given, as such object has already been “burned”.

`e0.world.dlcurves`

and `e0.country.dlcurves`

return a matrix of size *N \times M* where *N* is the number of trajectories and *M* is the number of values of *x*.

Hana Sevcikova

## Not run: sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output") mcmc.set <- get.e0.mcmc(sim.dir = sim.dir) e0.DLcurve.plot(mcmc.set, country = "Japan", burnin = 40) e0.parDL.plot(mcmc.set, "Japan") # add the median of the hierarchical DL curves x <- seq(40, 90, length = 100) world <- e0.world.dlcurves(x, mcmc.set, burnin = 40) qw <- apply(world, 2, median) lines(x, qw, col = 'blue') ## End(Not run)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.