plot.list {BayesMortalityPlus} | R Documentation |

Function that returns a log-scale 'ggplot' of the mortality graduation returned by hp(), dlm(), hp_close() or dlm_close() functions.

```
## S3 method for class 'list'
plot(
x,
age = NULL,
Ex = NULL,
plotIC = TRUE,
plotData = TRUE,
labels = NULL,
colors = NULL,
linetype = NULL,
prob = 0.95,
...
)
```

`x` |
List of objects of the following classes: |

`age` |
Vector with the ages to plot the life tables. |

`Ex` |
Vector with the exposures of the selected ages. Its length must be equal to the age vector. This argument is only necessary when plotting poisson and binomial HP models. |

`plotIC` |
Logical. If 'TRUE'(default), plots the predictive intervals. |

`plotData` |
Logical. If 'TRUE' (default), plots the data used in the modelling as dots. |

`labels` |
Description of the curve (Optional). |

`colors` |
Vector of colours of the curves (Optional). |

`linetype` |
Vector with the line type of the curve. (Optional). |

`prob` |
Coverage probability of the predictive intervals. Default is '0.95'. |

`...` |
Other arguments. |

A 'ggplot' object with fitted life tables.

`plot.DLM()`

, `plot.HP()`

, `plot.BLC()`

and `plot.PredBLC()`

for single plots.

```
## Importing mortality data from the USA available on the Human Mortality Database (HMD):
data(USA)
## Selecting the log mortality rate of the 1990 male population ranging from 0 to 100 years old
USA1990 = USA[USA$Year == 1990,]
x = 0:90
Ex = USA1990$Ex.Male[x+1]
Dx = USA1990$Dx.Male[x+1]
qx_t = Dx/Ex
qx_t = 1 - exp(-qx_t)
y = log(qx_t)
## Fit poisson and lognormal HP model and DLM
fit = hp(x = x, Ex = Ex, Dx = Dx, model = "poisson",
M = 2000, bn = 1000, thin = 1)
fit2 = dlm(y, M = 100, bn = 0, thin = 1)
## Plot multiples life tables
plot(list(fit, fit2),
age = 0:110, Ex = USA1990$Ex.Male,
plotIC = FALSE, colors = c("red", "blue"),
labels = c("HP Poisson", "DLM"))
## Plot ClosedHP and ClosedDLM objects
close1 = hp_close(fit, method = "hp", x0 = 90)
close2 = dlm_close(fit2, method = "plateau")
plot(list(fit, fit2, close1, close2),
plotIC = FALSE, colors = c("red", "blue", "green", "purple"),
labels = c("HP", "DLM", "ClosedHP", "ClosedDLM"))
```

[Package *BayesMortalityPlus* version 0.1.1 Index]