get.tfr.prediction: Accessing a Prediction Object

View source: R/get_outputs.R

get.tfr.predictionR Documentation

Accessing a Prediction Object

Description

Function get.tfr.prediction retrieves results of a prediction and creates an object of class bayesTFR.prediction. Function has.tfr.prediction checks an existence of such results. Function available.tfr.predictions lists predictions available in the given simulation directory.

Usage

get.tfr.prediction(mcmc = NULL, sim.dir = NULL, mcmc.dir = NULL,
                    subdir = "predictions")

has.tfr.prediction(mcmc = NULL, sim.dir = NULL, subdir = "predictions")

available.tfr.predictions(mcmc = NULL, sim.dir = NULL, full.names = FALSE)

Arguments

mcmc

Object of class bayesTFR.mcmc.set used to make the prediction. It must correspond to a Phase II MCMC. If it is NULL, the prediction is loaded from directory given by sim.dir.

sim.dir

Directory where the prediction is stored. It should correspond to the value of the output.dir argument used in the tfr.predict function. Only relevant if mcmc is NULL.

mcmc.dir

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. It can be set to NA if no loading of the mcmc object is desired.

subdir

Subdirectory of sim.dir for this particular prediction.

full.names

Logical. If TRUE, the directory names are given as full paths, otherwise (default) only the base names.

Details

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 tfr.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.tfr.predictions can be used to view all available predictions in the simulation directory.

Value

Function has.tfr.prediction returns a logical indicating if a prediction exists for the given mcmc.

Function available.tfr.predictions returns a vector of directory names containing TFR predictions.

Function get.tfr.prediction returns an object of class bayesTFR.prediction.

Author(s)

Hana Sevcikova

See Also

bayesTFR.prediction, tfr.predict, summary.bayesTFR.prediction

Examples

sim.dir <- file.path(find.package("bayesTFR"), "ex-data", "bayesTFR.output")
pred <- get.tfr.prediction(sim.dir=sim.dir)
summary(pred, country="Canada")

PPgp/bayesTFR documentation built on Nov. 5, 2024, 1:57 p.m.