Generate weight matrix
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
).
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.
#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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.