Function get.e0.prediction
retrieves results of a prediction and creates an object of class bayesLife.prediction
. Function has.e0.prediction
checks an existence of such results. Analogously, functions get.e0.jmale.prediction
and has.e0.jmale.prediction
retrieve and check an existence of male predictions from a given female prediction object. Function available.e0.predictions
lists predictions available in the given simulation directory.
get.e0.prediction(mcmc = NULL, sim.dir = NULL, joint.male = FALSE,
mcmc.dir = NULL, subdir = "predictions")has.e0.prediction(mcmc = NULL, sim.dir = NULL, subdir = "predictions")
get.e0.jmale.prediction(e0.pred)
has.e0.jmale.prediction(e0.pred)
available.e0.predictions(mcmc = NULL, sim.dir = NULL, full.names = FALSE)
Functions has.e0.prediction
and has.e0.jmale.prediction
return a logical indicating if a prediction exists.
Functions get.e0.prediction
and get.e0.jmale.prediction
return an
object of class bayesLife.prediction
.
Function available.e0.predictions
returns a vector of directory names containing e0 predictions.
Object of class bayesLife.mcmc.set
used to make the prediction. If it is NULL
, the prediction is loaded from directory given by sim.dir
.
Directory where the prediction is stored. It should correspond to the value of the output.dir
argument used in the e0.predict
function. Only relevant if mcmc
is NULL
.
Logical. If TRUE
, the function is applied to a male prediction that was generated using the joint female-male model implemented in the function e0.jmale.predict
.
Optional argument to be used only in a special case when the mcmc object contained in the prediction object was estimated in different directory than in the one to which it points to (for example due to moving or renaming the original directory). The argument causes that the mcmc is redirected to the given directory.
Subdirectory of sim.dir
for this particular prediction.
Logical. If TRUE
, the directory names are given as full paths, otherwise (default) only the base names.
Object of class bayesLife.prediction
.
Hana Sevcikova
If mcmc
is not NULL
, the search directory is set to mcmc$meta$output.dir
. This approach assumes that the prediction was stored in the same directory as the MCMC simulation, i.e. the output.dir
argument of the e0.predict
function was set to NULL
. If it is not the case, the argument mcmc.dir
should be used.
Usually, all predictions are stored in the subdirectory “predictions” of the simulation directory. If the subdirectory has a different name, the argument subdir
should be used. This allows to keep multiple predictions in one (MCMC) simulation directory. The function available.e0.predictions
can be used to view all available predictions in the simulation directory.
Function get.e0.jmale.prediction
extracts male projections from the e0.pred
objects (which should be a female prediction object), if the male prediction was generated using the e0.jmale.predict
function. has.e0.jmale.prediction
checks if such male prediction was generated.
bayesLife.prediction
, e0.predict
, summary.bayesLife.prediction
, e0.jmale.predict
sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output")
pred <- get.e0.prediction(sim.dir = sim.dir)
# female prediction summary
summary(pred, country = "Canada")
if (FALSE) {
# male prediction summary
# (works only if a joint male prediction exists - not the case in this toy example)
summary(get.e0.jmale.prediction(pred), country = "Canada")}
Run the code above in your browser using DataLab