get.e0.prediction {bayesLife}R Documentation

Accessing a Prediction Object


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.


get.e0.prediction(mcmc = NULL, sim.dir = NULL, joint.male = FALSE, mcmc.dir = NULL)

has.e0.prediction(mcmc = NULL, sim.dir = NULL)





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.


Object of class bayesLife.prediction.


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.

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.


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.


Hana Sevcikova

See Also

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")

## Not run: 
# 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")
## End(Not run)

[Package bayesLife version 5.0-1 Index]