Description Usage Arguments Details Value Author(s) Source References Examples
Fit a Multivariate Random Walk Model to the input data
, a
multivariate time series.
1 2 |
data |
Numeric matrix with a multivariate time series. Series are arranged in rows with columns representing time. |
x |
Numerical vector indicating the age classes in input |
y |
Numerical vector indicating the years in input |
include.drift |
Should the Random Walk model include a linear drift
term? Default: |
lowess.smooth |
Logical. Should the estimatated vector of drift
parameters be smoothed using a lowess function? Default: |
... |
Arguments to be passed to or from other methods. |
For further information on the Multivariate Random Walk with drift see Appendix B in \insertCitehaberman2011;textualMortalityForecast.
An object of class MRW
with components:
input |
A list with the input data; |
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 |
A vector with the estimated drift parameters; |
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 |
Residuals from the fitted model. That is observed minus fitted values; |
sigma |
A matrix with the estimated variance covariance matrix; |
x |
Vector of ages used in fitting; |
y |
Vector of years used in fitting. |
Marius D. Pascariu
The original implementation of this function was taken from
StMoMo
R package.
1 2 3 4 5 6 7 8 9 10 11 12 | # Forecast mortality using a Multivariate Random Walk with Drift model
x <- 0:100
y <- 1980:2000
mx <- HMD_male$mx$GBRTENW[paste(x), paste(y)]
M <- model.MRW(data = log(mx), x = x, y = y, include.drift = TRUE)
P <- predict(M, h = 16)
R <- residuals(M)
pv <- exp(P$predicted.values)
matplot(pv, type = "l", log = "y")
matplot(t(pv), type = "l", log = "y")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.