Functions for plotting density of the posterior distribution of the MCMC parameters.
tfr.pardensity.plot(mcmc.list = NULL,
sim.dir = file.path(getwd(), "bayesTFR.output"),
chain.ids = NULL, par.names = tfr.parameter.names(trans = TRUE),
burnin = NULL, dev.ncol=5, low.memory = TRUE, …)
tfr.pardensity.cs.plot(country, mcmc.list=NULL,
sim.dir=file.path(getwd(), "bayesTFR.output"),
chain.ids=NULL, par.names=tfr.parameter.names.cs(trans=TRUE),
burnin=NULL, dev.ncol=3, low.memory=TRUE, …)
tfr3.pardensity.plot(mcmc.list = NULL,
sim.dir = file.path(getwd(), "bayesTFR.output"),
chain.ids = NULL, par.names = tfr3.parameter.names(),
burnin = NULL, dev.ncol=3, low.memory = TRUE, …)
tfr3.pardensity.cs.plot(country, mcmc.list=NULL,
sim.dir=file.path(getwd(), "bayesTFR.output"),
chain.ids=NULL, par.names=tfr3.parameter.names.cs(),
burnin=NULL, dev.ncol=2, low.memory=TRUE, …)
Name or numerical code of a country.
List of bayesTFR.mcmc
objects, or an object of class bayesTFR.mcmc.set
or of class bayesTFR.prediction
(allowed only for Phase II MCMCs). If it is NULL
, the parameter values are loaded from sim.dir
.
Directory with the MCMC simulation results. It is only used if mcmc.list
is NULL
.
List of MCMC identifiers to be plotted. If it is NULL
, all chains found in mcmc.list
or sim.dir
are plotted.
Names of parameters for which density should be plotted. By default all (possibly transformed) country-independent parameters are plotted if used within tfr.pardensity.plot
and tfr3.pardensity.plot
, or country-specific parameters are plotted if used within tfr.pardensity.cs.plot
and tfr3.pardensity.cs.plot
.
Number of iterations to be discarded from the beginning of each chain.
Number of column for the graphics device. If the number of parameters is smaller than dev.ncol
, the number of columns is automatically decreased.
Logical indicating if the processing should run in a low-memory mode. If it is FALSE
, traces of all available parameters are loaded into memory. Otherwise, parameters are loaded as they are needed and are not kept in the memory.
Further arguments passed to the density
function.
The functions plot the density of the posterior distribution either for country-independent parameters (tfr.pardensity.plot
for phase II MCMCs and tfr3.pardensity.plot
for phase III MCMCs) or for country-specific parameters (tfr.pardensity.cs.plot
for phase II and tfr3.pardensity.cs.plot
for phase III), one graph per parameter. One can restrict it to specific chains by setting the chain.ids
argument and to specific parameters by setting the par.names
argument.
If mcmc.list
is an object of class bayesTFR.prediction
(which is allowed in tfr.pardensity.plot
and tfr.pardensity.cs.plot
only) and if this object contains thinned traces, they are used instead of the full chains. In such a case, burnin
and chain.ids
cannot be modified - their value is set to the one used when the thinned traces were created, namely when running tfr.predict
. In a situation with long MCMC chains, this approach can significantly speed-up creation of the density plots.
# NOT RUN {
sim.dir <- file.path(find.package("bayesTFR"), "ex-data", "bayesTFR.output")
tfr.pardensity.plot(sim.dir=sim.dir)
tfr.pardensity.cs.plot(country="Ireland", sim.dir=sim.dir, bw=0.2)
# }
Run the code above in your browser using DataLab