Learn R Programming

BayesMortalityPlus (version 0.2.3)

plot.PredBLC: BLC: Plot the log-mortality of a prediction

Description

This functions plot the predicted log-mortality and the predict intervals of the log-mortality for a specific year in the prediction horizon

Usage

# S3 method for PredBLC
plot(x, h = NULL, prob = 0.95, plotIC = TRUE, age = NULL, ...)

Value

A 'ggplot' object with the predicted mortality rates and their predict intervals.

Arguments

x

A PredBLC object, result to the pred() function call on a BLC object.

h

A numeric vector specifying the year(s) in the prediction horizon to be calculated.

prob

A real number that represents the probability of the predict interval.

plotIC

Logical. If 'TRUE' (default), shows the predictive intervals.

age

A numeric vector indicating the modelled ages. (Optional).

...

Other arguments.

See Also

plot.HP(), plot.DLM() and plot.BLC for HP, DLM or BLC methods.

Examples

Run this code
## Importing log-mortality data from Portugal:
data(PT)
Y <- PT

## Fitting the model
fit = blc(Y = Y, M = 100, bn = 20)

#' ## Prediction for 10 years ahead
pred = predict(fit, h = 3)

## Plotting
plot(pred, h = 1)
plot(pred, h = 3, prob = 0.9)

Run the code above in your browser using DataLab