Description Usage Arguments Value See Also Examples
Generates a weight matrix given a group of ages and years
and a set of cohorts which are to be given zero weight. This
is useful for excluding some data points when fitting a
Stochastic Mortality Model (see fit.StMoMo
).
1 | genWeightMat(ages, years, clip = 0, zeroCohorts = NULL)
|
ages |
vector of ages. |
years |
vector of years. |
clip |
number of cohorts in the boundary to assign a zero weight. This can be be used to zero weigh some of the first and last cohorts in the data. |
zeroCohorts |
other cohort for which a zero weight is to be assigned. |
A 0-1 matrix with 0 for the zero-weighed cohorts.
1 2 3 4 5 6 7 8 9 10 11 12 | #Zero-weight the first three and last three cohorts
wxt1 <- genWeightMat(55:89, EWMaleData$years, clip = 3)
APCfit1 <- fit(apc(), data = EWMaleData, ages.fit = 55:89,
wxt = wxt1)
plot(APCfit1, parametricbx = FALSE, nCol = 3)
#Also Zero-weight the 1886 cohort
wxt2 <- genWeightMat(55:89, EWMaleData$years, clip = 3,
zeroCohorts = 1886)
APCfit2 <- fit(apc(), data = EWMaleData, ages.fit = 55:89,
wxt = wxt2)
plot(APCfit2, parametricbx = FALSE, nCol = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.