If period and cohort effects are taken into account (effects = TRUE) the method uses all available years and diagonals for estimation of the period and cohort effects.
autoSmoothAPC(data, effects = TRUE, cornerLength = 7,
affdDiagonals = NULL, affdYears = NULL, lower = head(c(0.01, 0.01, 0.01,
2, 0.001, 2, 0.001), 3 + effects * 4), upper = head(c(1.2, 1.8, 1.2, 12,
0.4, 12, 0.4), 3 + effects * 4), init = head(c(0.1, 0.1, 0.2, 4, 0.001, 4,
0.001), 3 + effects * 4), reltol = 0.001, parameters = NULL, trace = F,
control = list(nnzlmax = 1e+06, nsubmax = 2e+06, tmpmax = 2e+05),
weights = NULL)
Demographic data (log mortality) presented as a matrix. Row numbers represent ages and column numbers represet time.
Controls if the cohort and period effects are taken into account.
Sets the smallest length of a diagonal to be considered for cohort effects.
Diagonals to be used for cohort effects. The first diagonal is at the bottom left corner of the data matrix (maximal age and minimal time in the data matrix).
Years to be used for period effects.
Lowest possible values for the optimization procedure.
Highest possible values for the optimization procedure.
Initial values for the optimization procedure.
Relative tolerance parameter to be supplied to optim
function.
Optional model parameters. If not provided, they are estimated.
Controls if tracing is on.
The control data passed directly to rq.fit.sfn
function.
Define how much every observation effect the resulting smooth surface.
The parameter must have same dimentions as data
parameter.
Weights can be set to reciprocal of estimated standard deviation of the data.
A list of four components: smooth surface, period effects, cohort effects and parameters used for smoothing (passed as a parameter or estimated).
smoothAPC
and signifAutoSmoothAPC
. The latter might give slightly better performance.
# NOT RUN {
library(demography)
m <- log(fr.mort$rate$female[1:30, 150:160])
plot(m)
sm <- autoSmoothAPC(m)
plot(sm)
plot(sm, "period")
plot(sm, "cohort")
# }
Run the code above in your browser using DataLab