Fits a basis function model to demographic data. The function uses optimal orthonormal basis functions obtained from a principal components decomposition.
fdm(
data,
series = names(data$rate)[1],
order = 6,
ages = data$age,
max.age = max(ages),
method = c("classical", "M", "rapca"),
lambda = 3,
mean = TRUE,
level = FALSE,
transform = TRUE,
...
)
Object of class “fdm” with the following components:
Name of country
Ages from data
object.
Years from data
object.
Matrix of
demographic data as contained in data
. It takes the name given by
the series argument.
Matrix of fitted values.
Residuals (difference between observed and fitted).
Matrix of basis functions evaluated at each age level (one column for each basis function). The first column is the fitted mean.
Matrix of coefficients (one column for each coefficient series). The first column are all ones.
Standard errors for the estimated mean function.
Proportion of variation explained by each basis function.
Weight associated with each time period.
Measure of variation for each time period.
Data type (mortality, fertility, etc.)
The data stored as a functional time series object.
demogdata object. Output from read.demogdata.
name of series within data holding rates (1x1).
Number of basis functions to fit.
Ages to include in fit.
Maximum age to fit. Ages beyond this are collapsed into the upper age group.
Method to use for principal components decomposition.
Possibilities are “M”, “rapca” and “classical”. See
ftsm
for details.
Tuning parameter for robustness when method="M"
.
If TRUE, will estimate mean term in the model before computing basis terms. If FALSE, the mean term is assumed to be zero.
If TRUE, will include an additional (intercept) term that depends on the year but not on ages.
If TRUE, the data are transformed with a Box-Cox transformation before the model is fitted.
Extra arguments passed to ftsm
.
Rob J Hyndman
Hyndman, R.J., and Ullah, S. (2007) Robust forecasting of mortality and fertility rates: a functional data approach. Computational Statistics & Data Analysis, 51, 4942-4956. https://robjhyndman.com/publications/funcfor/
ftsm
, forecast.fdm
france.fit <- fdm(fr.mort)
summary(france.fit)
plot(france.fit)
plot(residuals(france.fit))
Run the code above in your browser using DataLab