Description Usage Arguments Value See Also Examples
View source: R/model_OeppenC.R
The Coherent Oeppen Mortality Model (Oeppen-C)
1 |
data |
A data.frame or a matrix containing mortality data
with ages |
data.B |
A data.frame or a matrix containing mortality data for the
benchmark population. Must be the same format as in |
x |
Numerical vector indicating the ages in input |
y |
Numerical vector indicating the years in input |
verbose |
A logical value. Set |
... |
Arguments to be passed to or from other methods. |
The output is a list with the components:
input |
List with arguments provided in input. Saved for convenience; |
info |
Short details about the model; |
call |
An unevaluated function call, that is, an unevaluated expression which consists of the named function applied to the given arguments; |
coefficients |
Estimated coefficients; |
fitted.values |
Fitted values of the estimated model; |
observed.values |
The observed values used in fitting arranged in the same format as the fitted.values; |
residuals |
Deviance residuals; |
x |
Vector of ages used in the fitting; |
y |
Vector of years used in the fitting; |
benchmark |
An object of class |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Example 1 ----------------------
# Data
x <- 0:110
y <- 1980:2016
dx_M <- HMD_male$dx$USA[paste(x), paste(y)]
dx_F <- HMD_female$dx$USA[paste(x), paste(y)]
# Replace zeros
dx_M <- replace.zeros(dx_M)
dx_F <- replace.zeros(dx_F)
# Fit model for US males using US females as benchmark
M <- model.OeppenC(data = dx_M,
data.B = dx_F,
x = x, y = y)
M
summary(M)
coef(M)
coef(M$benchmark)
# Plot observed and fitted values
plot(M, plotType = "observed")
plot(M, plotType = "fitted")
# Plot residuals
R <- residuals(M)
plot(R, plotType = "scatter")
plot(R, plotType = "colourmap")
plot(R, plotType = "signplot")
# Perform forecasts
P <- predict(M, h = 16)
P
plot(P, plotType = "mean")
plot(P, plotType = "lower")
plot(P, plotType = "upper")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.