| tfr.trajectories.plot | R Documentation |
The functions plot/tabulate the posterior distribution of TFR trajectories for a given country, or for all countries, including their median and given probability intervals.
tfr.trajectories.plot(tfr.pred, country, pi = c(80, 95),
half.child.variant = TRUE, nr.traj = NULL,
adjusted.only = TRUE, typical.trajectory = FALSE,
mark.estimation.points = FALSE,
traj.index = NULL, show.mean = FALSE, show.median = TRUE,
xlim = NULL, ylim = NULL, type = 'b', xlab = 'Year', ylab = 'TFR',
main = NULL, lwd = c(2, 2, 2, 2, 2, 1),
col=c('black', 'green', 'red', 'red', 'blue', '#00000020'),
show.legend = TRUE, add = FALSE, uncertainty = FALSE,
col_unc = "purple", ...)
tfr.trajectories.plot.all(tfr.pred,
output.dir = file.path(getwd(), 'TFRtrajectories'),
output.type = "png", main = NULL, verbose = FALSE, ...)
tfr.trajectories.table(tfr.pred, country, pi = c(80, 95),
half.child.variant = TRUE, adjusted = TRUE,
main.proj = c("median", "mean"), estim.observed = TRUE)
tfr.pred |
Object of class |
country |
Name or numerical code of a country. It can also be given as ISO-2 or ISO-3 characters. |
pi |
Probability interval. It can be a single number or an array. |
half.child.variant |
If |
nr.traj |
Number of trajectories to be plotted. If |
adjusted.only |
Logical. By default, if the projection or estimation median is adjusted using e.g. |
typical.trajectory |
Logical. If |
mark.estimation.points |
Logical. If |
traj.index |
Vector of trajectory indices to show. If not given, the trajectories are selected using equidistant spacing. |
show.mean, show.median |
Logical indicating if the mean or/and the median of the distribution should be shown. If |
xlim, ylim, type, xlab, ylab |
Graphical parameters passed to the |
lwd, col |
Vector of six elements giving the line width and color for: 1. observed data, 2. imputed missing data, 3. median, 4. quantiles, 5. half-child variant, 6. trajectories. |
show.legend |
Logical controlling whether the legend should be drawn. |
add |
Logical controlling whether the trajectories should be plotted into a new graphic device ( |
... |
Additional graphical parameters. In addition, for |
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”. |
main |
Main title for the plot(s). In |
verbose |
Logical switching log messages on and off. |
uncertainty |
Logical: |
col_unc |
Color of past TFR estimation uncertainty plot. |
adjusted |
Logical. If |
main.proj |
Statistics that should be shown in the table as first column. By default, the median is shown, but can be changed to show the mean. It applies also to the historical data, if the simulation accounted for past uncertainty. |
estim.observed |
Logical. If the simulation accounted for past uncertainty, by default the historical time periods of the first column in the table correspond to the median (default) or the mean of the esitmated distribution. If this argument is set to |
tfr.trajectories.plot plots posterior distribution of TFR trajectories for a given country. tfr.trajectories.table gives the same output as a table. tfr.trajectories.plot.all creates a set of graphs (one per country) that are stored in output.dir.
The median (or mean) and given probability intervals are computed using all available trajectories. Thus, nr.traj does not influence those values - it is used only to control the number of trajectories plotted.
Hana Sevcikova, Leontine Alkema, Peiran Liu
bayesTFR.prediction
## Not run:
sim.dir <- file.path(find.package("bayesTFR"), "ex-data", "bayesTFR.output")
pred <- get.tfr.prediction(sim.dir)
tfr.trajectories.plot(pred, country="Burkina Faso", pi=c(80, 95))
tfr.trajectories.table(pred, country="Burkina Faso", pi=c(80, 95))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.