plot_param_fn: A function to plot the fitted parameters of stochastic...

View source: R/plot_param_fn.R

plot_param_fnR Documentation

A function to plot the fitted parameters of stochastic mortality models, accompanied by credible intervals

Description

Plot the fitted parameters, accompanied by credible intervals (user-specified level), using posterior samples stored in "fit_result" object.

Usage

plot_param_fn(result, pred_int = 0.95, legends = TRUE)

Arguments

result

object of type either "fit_result" or "BayesMoFo".

pred_int

A numeric value (between 0 and 1) specifying the credible level of uncertainty bands. Default is pred_int=0.95 (95\% intervals).

legends

A logical value to indicate if legends of the plots should be shown (default) or suppressed (e.g. to aid visibility).

Value

A plot illustrating the median fitted and forecast parameters, accompanied by credible intervals.

Examples


#load and prepare data
data("dxt_array_product");data("Ext_array_product")
death<-preparedata_fn(dxt_array_product,strat_name = c("ACI","DB","SCI"),ages=35:65)
expo<-preparedata_fn(Ext_array_product,strat_name = c("ACI","DB","SCI"),ages=35:65)

#fit any mortality model
runBayesMoFo_result<-runBayesMoFo(death=death,expo=expo,n_iter=1000,models="APCI",
  family="poisson",forecast=TRUE)

#default plot
plot_param_fn(runBayesMoFo_result)

#with 80% credible intervals 
plot_param_fn(runBayesMoFo_result,pred_int=0.8)


BayesMoFo documentation built on Aug. 11, 2025, 1:07 a.m.