smoothAPC (version 0.3)

smoothAPC: Smooths demographic data optionally taking into account period and cohort effects

Description

Smooths demographic data optionally taking into account period and cohort effects

Usage

smoothAPC(data, lambda = 1, lambdaaa = 1, lambdayy = 1, lambdaay = 1,
  lambdaYearsEffect = 5, thetaYearsEffect = 0.1 * lambda,
  lambdaCohortEffect = 5, thetaCohortEffect = 0.1 * lambda,
  cornerLength = 7, effects = TRUE, affdDiagonals = NULL,
  affdYears = NULL, control = list(nnzlmax = 1e+06, nsubmax = 2e+06, tmpmax
  = 2e+05), weights = NULL)

Arguments

data

Demographic data (log mortality) presented as a matrix. Row numbers represent ages and column numbers represet time.

lambda

Controls "general flexibility" of the smooth surface.

lambdaaa

Controls "flexibility" of the smooth surface in age direction (first dimension).

lambdayy

Controls "flexibility" of the smooth surface in years direction (second dimension).

lambdaay

Controls "flexibility" of the smooth surface in age and years directions.

lambdaYearsEffect

Controls "flexibility" of the period effects.

thetaYearsEffect

Reduces the likelihood of period effects.

lambdaCohortEffect

Controls "flexibility" of the cohort effects.

thetaCohortEffect

Reduces the likelihood of cohort effects.

cornerLength

Sets the smallest length of a diagonal to be considered for cohort effects.

effects

Controls if the cohort and period effects are taken into account.

affdDiagonals

Diagonals to be used for cohort effects.

affdYears

Years to be used for period effects.

control

Control data passed directly to rq.fit.sfn function..

weights

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.

Value

List of three components: smooth surface, period effects, cohort effects.

References

http://robjhyndman.com/publications/mortality-smoothing/

See Also

autoSmoothAPC, signifAutoSmoothAPC.

Examples

Run this code
# NOT RUN {
library(demography)
m <- log(fr.mort$rate$female[1:30, 150:160])
sm <- smoothAPC(m, lambdaaa = 0.2, lambdayy = 0.1, lambdaay = 0.4, effects = FALSE)
plot(sm, "original")
plot(sm)

# }

Run the code above in your browser using DataCamp Workspace