95 views

Uploaded by Ivo Rodrigues

R Demography Package

- IJF11 Carson Airtravel Forecast
- Data Description.pdf
- Chapter 2 Practice Answers
- WASTE
- Approaches to Human Resource Planning
- STAT MCT
- FIX BHS INGGRIS OTW LANCAR BISMILLAH.pptx
- Chapter 14 Statistics
- Week 05 Part 2
- Math-10-Quarter-4.docx
- Inner.pdf
- Forecasting Template
- Sales Forecasting
- Combining National and Constituency Polling for Forecasting
- 2
- Environmental analysis has several benefits like those mentioned below.docx
- Delphi Technique Rowe Wright
- Marwala's MSc Dissertation
- Cashflow Forecast
- Ch_01_Wooldridge_6e_PPT_Updated.ppt

You are on page 1of 47

October 26, 2012

Version 1.14 Date 2012-10-11 Title Forecasting mortality, fertility, migration and population data Author Rob J Hyndman with contributions from Heather Booth, Leonie Tickle, John Maindonald, Simon Wood and R Core Team. Maintainer Rob J Hyndman <Rob.Hyndman@monash.edu> Depends R (>= 2.15.2), forecast (>= 3.09), rainbow, ftsa Suggests mgcv, cobs, strucchange, RCurl LazyData yes Description Functions for demographic analysis including lifetable calculations; Lee-Carter modelling; functional data analysis of mortality rates, fertility rates, net migration numbers; and stochastic population forecasting. License GPL (>= 2) URL http://robjhyndman.com/software/demography Repository CRAN Date/Publication 2012-10-26 07:04:31

R topics documented:

demography-package aus.fert . . . . . . . cm.spline . . . . . . coherentfdm . . . . . combine.demogdata . compare.demogdata . demogdata . . . . . . extract.ages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 10

2 extract.years . . . . fdm . . . . . . . . forecast.fdm . . . . forecast.fdmpr . . . forecast.lca . . . . fr.mort . . . . . . . hmd.mx . . . . . . isfe . . . . . . . . . lca . . . . . . . . . life.expectancy . . lifetable . . . . . . mean.demogdata . median . . . . . . . models . . . . . . . netmigration . . . . plot.demogdata . . plot.errorfdm . . . plot.fmforecast . . plot.lifetable . . . . pop.sim . . . . . . read.demogdata . . residuals.fdm . . . set.upperage . . . . sex.ratio . . . . . . simulate.fmforecast smooth.demogdata summary.fdm . . . tfr . . . . . . . . . update.fmforecast . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

demography-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 11 13 14 15 16 17 19 20 23 24 26 27 28 29 30 31 32 33 34 35 37 38 38 39 40 42 43 44 46

demography-package

Forecasting mortality and fertility data

Description Functions for demographic analysis including lifetable calculations, Lee-Carter modelling and functional data analysis of mortality rates. Author(s) Rob J Hyndman with contributions from Heather Booth, Leonie Tickle, John Maindonald, Simon Wood and the R Core Team. Maintainer: <Rob.Hyndman@monash.edu>

aus.fert

3

aus.fert

Australian fertility data

Description Age-speciﬁc fertility rates and female child-bearing population for Australia.

Format Object of class demogdata containing the following components: year Vector of years age Vector of ages rate List containing one matrix with one age group per row and one column per year. pop Population data in same form as rate. type Type of object. In this case, “fertility”. label Character string giving area from which data are taken. In this case, “Australia”.

Details Australian fertility rates and populations (1921-2002) for age groups (<20, 20-24, 25-29, 30-34, 35-39, 40-44, 45+). Data taken from v3.2b of the Australian Demographic Data Bank released 10 February 2005.

Author(s) Rob J Hyndman

Source The Australian Demographic Data Bank (courtesy of Len Smith).

Examples

plot(aus.fert)

4

cm.spline

cm.spline

Monotonic interpolating splines

Description Perform cubic spline monotonic interpolation of given data points, returning either a list of points obtained by the interpolation or a function performing the interpolation. The splines are constrained to be monotonically increasing (i.e., the slope is never negative). Usage cm.splinefun(x, y = NULL, ...) cm.spline(x, y = NULL, n = 3*length(x), xmin = min(x), xmax = max(x), ...) Arguments x,y n xmin xmax ... Details From version 1.14 in R 2.15.2 or later, these are simply wrappers to the spline and splinefun functions from the stats package. Value cm.spline cm.splinefun returns a list containing components x and y which give the ordinates where interpolation took place and the interpolated values. returns a function which will perform cubic spline interpolation of the given data points. This is often more useful than spline. vectors giving the coordinates of the points to be interpolated. Alternatively a single plotting structure can be speciﬁed: see xy.coords. interpolation takes place at n equally spaced points spanning the interval [xmin, xmax]. left-hand endpoint of the interpolation interval. right-hand endpoint of the interpolation interval. Other arguments are ignored.

Author(s) Rob J Hyndman References Forsythe, G. E., Malcolm, M. A. and Moler, C. B. (1977) Computer Methods for Mathematical Computations. Hyman (1983) SIAM J. Sci. Stat. Comput. 4(4):645-654. Dougherty, Edelman and Hyman 1989 Mathematics of Computation, 52: 471-494.

.seq( .fdmpr demogdata object containing at least two groups. col = 3) # Monotonic 5 coherentfdm Coherent functional demographic model for grouped data Description Fits a coherent functional model to demographic data as described in Hyndman. Booth. Booth & Yasmeen (2012). n = 2 1). com/papers/coherentfdm See Also fdm.J.sort(rnorm(2 )) plot(x.l=2 ) y <. Demography.. y.) . (2012) Coherent mortality forecasting: the productratio method with functional time series models. http://robjhyndman. Usage coherentfdm(data. forecast. Otherwise it will use all available groups. being the models for the ratio of each series with the geometric mean). Arguments data order1 order2 . Extra arguments passed to fdm.. Number of basis functions to ﬁt to the model for the geometric mean. and Yasmeen.4. Number of basis functions to ﬁt to the models for each ratio. order1=6.y) lines(spline(x. If two of the series in data are named male and female. Value A list (of class fdmpr) consisting of two objects: product (an fdm object containing a model for the geometric mean of the data) and ratio (a list of fdm objects. R. References Hyndman.. Author(s) Rob J Hyndman.. y. then it will use these two groups.spline(x... to appear. n = 2 1).coherentfdm Examples x <. order2=6. H. F. col = 2) # Not necessarily monotonic lines(cm.

The standard use for this function will be combining historical data with forecasts.years(fr.demogdata(obj1.short <. .g. obj2) Arguments obj1 obj2 Value Object of class “demogdata” with the following components: year age rate pop type label Author(s) Rob J Hyndman See Also demogdata Vector of years Vector of ages Matrix of rates with with one age group per row and one column per year. This is only produced when both objects contain a pop component. Type of object: “mortality”.extract. Usage combine. Matrix of populations in same form as rate and containing population numbers.fit <.sm.fit) plot(fr. Second demogdata object (e. First demogdata object (e.. Name of area from which the data are taken.6 Examples fr. “fertility” or “migration”.coherentfdm(fr. components=3) 6) combine.short) summary(fr.g. historical data). The objects must be of the same type.demogdata combine.. forecasts).195 :2 fr.demogdata Combine two demogdata objects into one demogdata object Description Function to combine demogdata objects containing different years but the same age structure into one demogdata object.fit$product.

demogdata(fr.combine. forecast. interpolate=FALSE) Arguments data forecast series ages max.mort) fcast <.lty=3) 7 compare.age=min(max(data$age).fdm(fr.mort. series=names(forecast$rate)[1]. Ages from data object. years=data$year.demogdata(data.expectancy(france2)) lines(rep(max(fr. Ages to use for comparison. ages = data$age.compare.c( . Value Object of class "errorfdm" with the following components: label age year <error> Name of region from which data taken. all zeros in data are replaced by interpolated estimates when computing the error measures on the log scale. Years to use in comparison.demogdata Evaluation of demographic forecast accuracy Description Computes mean forecast errors and mean square forecast errors for each age level.1 ). Name of series to use.lca. h=5 ) france2 <.2). Upper age to use for comparison. Default: all available ages.mort$year)+ . Demogdata object such as created using forecast.demogdata containing actual demographic rates.fdm or forecast. max. Error measures on the original (rate) scale are unchanged.demogdata Examples fit <.forecast(fit.5. . Default: the ﬁrst matrix within forecast$rate.fcast) plot(france2) plot(life. Computes integrated squared forecast errors and integrated absolute percentage forecast errors for each year. If TRUE. Usage compare. Years from data object.age years interpolate Demogdata object such as created using read. Default is to use all available years that are common between data and forecast. Matrix of forecast errors on rates.max(forecast$age)).

error[.error life. xlab="Year". Speciﬁcally ME=mean error.extract. demogdata Various measures of forecast accuracy averaged across years.fit.compare. label. Usage demogdata(data.xlab="Age".order=2) fr. pop.fit <.demogdata(fr.mort.errorfdm Examples fr. type="l"."ISE"]. If data$type="mortality".plot.error$age."ME"].years(fr. forecast(fr.test <.demogdata and ﬁtting an LC or BMS model using lca or an FDA model using fdm.ylab="Mean Forecast Error") plot(fr. lambda) .fr. Author(s) Rob J Hyndman See Also forecast. forecast and actual-forecast for life expectancies. Various measures of forecast accuracy integrated across ages.error[.error$int. ISE=integrated squared error.error) par(mfrow=c(2. name.years=1921:198 ) fr.8 <logerror> mean.error$mean.fdm. IPE=integrated percentage error and IAPE=integrated absolute percentage error. Speciﬁcally IE=integrated error. MPE=mean percentage error and MAPE=mean absolute percentage error. int.error <. type. female or total.test.sm.2 )) plot(fr. function returns this component which is a matrix containing actual.ylab="Integrated Square Error") demogdata Create demogdata object from raw data matrices Description Create demogdata object suitable for plotting using plot. years.fdm(fr.error Matrix of forecast errors on log rates. ages.expectancy Note that the error matrices have different names indicating if the series forecast was male.1)) plot(fr. MSE=mean squared error.

the number of deaths is data*pop if data contains mortality rates. Character string showing type of demographic series: either “mortality”. So. “fertility” or “migration”. Name of series: usually male.demogdata Arguments data pop Matrix of data: either mortality rates or fertility rates 9 Matrix of population values of same dimension as data. the "exposures"). A list of the same form as rate but containing population numbers instead of demographic rates.. Name of area from which the data are taken. Vector of ages corresponding to rows of data. “fertility” or “migration”.demogdata . for example. ages years type label name lambda Value Object of class “demogdata” with the following components: year age rate pop type label lambda Vector of years Vector of ages A list containing one or more rate matrices with one age group per row and one column per year. Type of object: “mortality”. Box-Cox transformation parameter. female or total.e. Vector of years corresponding to columns of data. These are population numbers as at 30 June of each year (i. label lambda Author(s) Rob J Hyndman See Also read.

upper Demogdata object such as created using read. ages beyond the maximum of ages are combined into the upper age group.FALSE) plot(france.teens <.ages(fr. Usage extract.years Extract some years from a demogdata object Description Creates subset of demogdata object.demogdata or smooth. years) Arguments data years Demogdata object such as created using read. combine.teens) extract.demogdata. Usage extract.years extract.years(data.demogdata or smooth.ages Extract some ages from a demogdata object Description Creates subset of demogdata object.10 extract. Value Demogdata object with same components as data but with a subset of ages.upper=TRUE) Arguments data ages combine. Vector of years to extract from data . Author(s) Rob J Hyndman Examples france. Vector of ages to extract from data If TRUE.ages(data.13:19. ages.demogdata.extract.mort.

years(fr. Usage fdm(data.age = 1 . order = 6.. Tuning parameter for robustness when method="M". Ages beyond this are collapsed into the upper age group. name of series within data holding rates (1x1) Number of basis functions to ﬁt. mean = TRUE. will estimate mean term in the model before computing basis terms.mort. Author(s) Rob J Hyndman Examples france. "rapca"). level = FALSE. If TRUE. Method to use for principal components decomposition. Extra arguments passed to ftsm. Possibilities are “M”. max. transform = TRUE. . Ages to include in ﬁt. Output from read. the mean term is assumed to be zero. Maximum age to ﬁt.extract.1918 <.) Arguments data series order ages max. See ftsm for details. series = names(data$rate)[1]. demogdata object. . “rapca” and “classical”. lambda = 3. ages = data$age. the data are transformed with a Box-Cox transformation before the model is ﬁtted.fdm Value Demogdata object with same components as data but with a subset of years.demogdata.age method lambda mean level transform . method = c("classical". If TRUE.. will include an additional (intercept) term that depends on the year but not on ages.1918) 11 fdm Functional demographic model Description Fits a basis function model to demographic data. The function uses optimal orthonormal basis functions obtained from a principal components decomposition.. "M".. If FALSE. If TRUE.

fdm Matrix of demographic data as contained in data.fit)) . Proportion of variation explained by each basis function.12 Value Object of class “fdm” with the following components: label age year <series> fitted residuals basis coeffs mean. Hyndman.se varprop weights v type y Author(s) Rob J Hyndman. Standard errors for the estimated mean function.) The data stored as a functional time series object. com/papers/funcfor See Also ftsm.fit <. Weight associated with each time period. 51. 4942-4956.fdm Examples france.mort) summary(france. The ﬁrst column are all ones.J. The ﬁrst column is the ﬁtted mean.fit) plot(france. http://robjhyndman. Matrix of ﬁtted values. Matrix of coefﬁcients (one column for each coefﬁcient series).fdm(fr. and Ullah. etc. Computational Statistics & Data Analysis. It takes the name given by the series argument. forecast. Measure of variation for each time period. Data type (mortality. S.fit) plot(residuals(france. Matrix of basis functions evaluated at each age level (one column for each basis function). Residuals (difference between observed and ﬁtted).. Years from data object. R. fertility. (2007) Robust forecasting of mortality and fertility rates: a functional data approach. References Name of country Ages from data object.

Value Object of class fmforecast with the following components: label age year rate Name of region from which the data are taken. Years from lcaout object. "actual"). The forecast coefﬁcients are then multiplied by the basis functions to obtain a forecast demographic rate curve.) Arguments object h level jumpchoice method warnings . the forecasts are bias-adjusted by the difference between the ﬁt and the last year of observed data. mean. “fertility” or “migration”. Output from fdm.error var model type . List containing the various components of variance: model. error. If TRUE. h = 5 . warnings=FALSE. Conﬁdence level for prediction intervals. no adjustment is used. Ages from lcaout object. total and coeff... Otherwise. level=8 . lower bound and upper bound of prediction intervals.. List of matrices containing forecasts.fdm Forecast functional demographic model. error fitted coeff coeff. Description The coefﬁcients from the ﬁtted object are forecast using a univariate time series model. . so the default is warnings=FALSE. Most of these can be ignored. Type of data: “mortality”.ftsm. Matrix of one-step errors for historical data Matrix of one-step forecasts for historical data List of objects of type forecast containing the coefﬁcients and their forecasts. One-step errors for each of the coefﬁcients.fdm 13 forecast. jumpchoice = c("fit". Usage ## S3 method for class ’fdm’ forecast(object. Other arguments as for forecast. method = "arima". If "actual". Forecast horizon. Forecasting method to be used. Fitted model in obj. Point forecast matrix takes the same name as the series that has been forecast. warnings arising from the forecast models for coefﬁcients will be shown.forecast..

. Range of fractional differencing parameter for the ratio coefﬁcients.ftsm.lca.fcast) models(france. .order=2) france. Value Object of class fmforecast2 containing a list of objects each of class fmforecast. . ..14 Author(s) Rob J Hyndman.mort. Usage ## S3 method for class ’fdmpr’ forecast(object. K=1 . . Maximum number of years to use in forecasting coefﬁcients for ratio components.fit <. drange=c( .5).fcast) forecast.fit. Forecast horizon. forecast.. forecast. Other arguments as for forecast. and the results combined to give forecasts for each group in the original data.fcast <. Then the forecasts from the product model.fdmpr forecast. Output from coherentfdm.) Arguments object h level K drange .fdm. See Also fdm. Conﬁdence level for prediction intervals.5 ) plot(france. level=8 . and ﬁnally a list of forecasts from each of the ratio models.fdm(fr. Description The product and ratio models from coherentfdm are forecast.forecast(france. Examples france. Author(s) Rob J Hyndman.. The forecasts for each group in the original data are given ﬁrst.fdmpr Forecast coherent functional demographic model. h=5 .

Usage ## S3 method for class ’lca’ forecast(object.type=’component’.. .195 :2 6) fr. Value Object of class fmforecast with the following components: label age year Region from which the data are taken. Conﬁdence level for prediction intervals.sm.. jumpchoice = c("fit".fcast$male) plot(fr. "innovonly").fcast <. The forecast coefﬁcients are then multiplied by bx to obtain a forecast demographic rate curve.fcast$ratio$male. Examples fr. Number of years ahead to forecast. level = 8 . h = 5 .forecast(fr.fit) plot(fr.lca See Also coherentfdm. Possibilities: “innovdrift” (innovations and drift) and “innovonly” (innovations only).. Description The kt coefﬁcients are forecast using a random walk with drift. Output from lca.lca Forecast demogdata data using Lee-Carter method.short <. "actual").fcast) 15 forecast. components=3) models(fr.fdm. se = c("innovdrift".fit <. Possibilities: “actual” (use actual rates from ﬁnal year) and “ﬁt” (use ﬁtted rates). Method used for computation of standard error. .short) fr. Years from object.years(fr. Method used for computation of jumpchoice.. forecast.extract.coherentfdm(fr. Other arguments. Ages from object.forecast.) Arguments object h se jumpchoice level . plot.

Details about the ﬁtted model fr. female.mort.mort French mortality data Description Age-speciﬁc mortality rates and population for France. pop Population data in same form as rate.fcast.lca <.mort contains French mortality rates and populations (1899-2005) for ages 0-110. Data type. “France”. Data taken from the Human Mortality Database on 20 February 2008. type Type of object.mort obtained using the smooth.demogdata function. Matrix of one-step forecasts for historical data fitted Other components included are e kt. In this case. Details fr. Point forecast matrix takes the same name as the series that has been forecast. “mortality”.f type model Author(s) Rob J Hyndman. Format Object of class demogdata containing the following components: year Vector of years age Vector of ages rate List of matrices containing rates with with one age group per row and one column per year.lca(fr.lca.16 rate fr.forecast(france. male. label Character string giving area from which data are taken. 5 ) plot(france.mort List of matrices containing forecasts.sm contains a smoothed version of fr.fcast <. Examples france. .fcast) plot(france. lower bound and upper bound of prediction intervals.’c’) Forecasts of life expectancies (including lower and upper bounds) Forecasts of coefﬁcients from the model. adjust="e ") france. fr. In this case. Matrices: total.

sm.mx Author(s) Rob J Hyndman Source The Human Mortality Database (http://www.mort.demogdata and ﬁtting an LC or BMS model using lca or an FDA model using fdm.mx(country. . Usage hmd. Australia Austria Belarus AUS AUT BLR Directory abbreviation from the HMD.org).hmd.org). label = country) hmd.years=199 ) 17 hmd. users are required to create their account via the HMD website (http: //www.mort. Australia = "AUS". password.org) and constructs a demogdata object suitable for plotting using plot. and obtain a valid username and password.e reads life expectancy at birth from the Human Mortality Database and returns the result as a ts object.type=’p’. See below for other countries. HMD username HMD password Character string giving name of country from which the data are taken.mortality.mortality. The country codes (as at 31 July 2012) are as follows.years=195 :1997) plot(fr. username. For instance.mx Read demographic data from the Human Mortality Database Description hmd.e (country. hmd.mortality.mx reads "Mx" (1x1) data from the Human Mortality Database (http://www.years=199 .pch=1) lines(fr. Examples plot(fr. password) Arguments country username password label Details In order to read the data. username.

A. Ukraine BEL BGR CAN CHL CZE DNK EST FIN FRATNP FRACNP DEUTNP DEUTFRG DEUTGDR HUN ISL IRL ISR ITA JPN LVA LTU LUX NLD NZL_NP NZL_MA NZL_NM NOR POL PRT RUS SVK SVN ESP SWE CHE TWN GBR_NP GBRTENW GBRCENW GBR_SCO GBR_NIR USA UKR hmd.S.mx .18 Belgium Bulgaria Canada Chile Czech Republic Denmark Estonia Finland France – France total population – France civilian population Germany – Germany total population – West Germany – East Germany Hungary Iceland Ireland Israel Italy Japan Latvia Lithuania Luxembourg Netherlands New Zealand – NZ total population – NZ Maori – NZ non-Maori Norway Poland Portugal Russia Slovakia Slovenia Spain Sweden Switzerland Taiwan United Kingdom – UK Total Population – England & Wales Total Population – England & Wales Civilian Population – Scotland – Northern Ireland U.

Type of object: “mortality”. lambda=3. series=names(data$rate)[1].order=N-3.) ..na". female and total."struct".org/cgi-bin/hmd/hmd_download. label hmd. Usage ## S3 method for class ’demogdata’ isfe(data. username. h=5:1 .expectancy Examples ## Not run: norway <.mx("NOR". Value hmd."arfima". "M". A list of the same form as rate but containing population numbers instead of demographic rates. ages=data$age.life. N=1 . .demogdata. fmethod = c("arima"."ar".e returns an object of class ts with columns male."rwdrift".. "Norway") summary(norway) ## End(Not run) isfe Integrated Squared Forecast Error for models of various orders Description Computes ISFE values for functional time series models of various orders. password."rw").age=1 .hmd. max.isfe 19 Later additions to the HMD are listed at http://www.read. Author(s) Rob J Hyndman See Also demogdata. method=c("classical".mx returns an object of class demogdata with the following components: year age rate pop type label Vector of years Vector of ages A list containing one or more rate matrices with one age group per row and one column per year."ets. “fertility” or “migration”. php."ets". "rapca"). max.mortality.

. Computational Statistics & Data Analysis. Author(s) Rob J Hyndman. forecast. “rwdrift” and “rw”. although many other options are available.J.order. com/papers/funcfor See Also fdm. Current possibilities are “ets”. bms is a wrapper for lca and returns a model based on the BoothMaindonald-Smith methodology. (2007) Robust forecasting of mortality and fertility rates: a functional data approach.order+1) rows and length(h) columns containing ISFE values for models of orders 0:max. S. Maximum age to ﬁt.. name of series within data holding rates (1x1) Ages to include in ﬁt. 4942-4956. lca produces a standard Lee-Carter model by default. R. 51. “struct”. Maximum number of basis functions to ﬁt. http://robjhyndman. Method used for forecasting. Tuning parameter for robustness when method="M".order N h method fmethod lambda . and Ullah. “ets. Additional arguments control the ﬁtting procedure. Minimum number of functional observations to be used in ﬁtting a model. Possibilities are “M”. Numeric matrix with (max. lca Method to use for principal components decomposition.. . References Hyndman.fdm. “rapca” and “classical”. Value demogdata object.age max.na”. “arima”. lca Model mortality data using Lee-Carter approach Description Lee-Carter model of mortality rates. Forecast horizons over which to average.20 Arguments data series ages max.

breakmethod = c("bms". "rates". name of series within data containing mortality values (1x1) years to include in ﬁt. "deaths").demogdata.lca Usage lca(data. "none").age=1 . Minimum number of years to include in ﬁtting period if chooseperiod=TRUE. chooseperiod=FALSE. If TRUE. Value Object of class “lca” with the following components: label Name of region . "dxt". Forecasts from this model can be obtained using forecast. interpolate = FALSE) bms(data. minperiod = 2 . it will rescale bx and kt so that kt has drift parameter = 1. scale = FALSE. “dt” (Lee-Carter method). Possibilities are “logrates”. “e0” (method based on life expectancy) and “none”. "rates". series=names(data$rate)[1]. Possibilities are “dxt” (BMS method). restype = c("logrates". The function produces a model for the series mortality rate matrix within data$rate. If TRUE. ages=data$age.age=1 . interpolate = FALSE) Arguments data series years ages max. series=names(data$rate)[1]. Each column is one year. If TRUE. Ages beyond this are collapsed into the upper age group. Output from read. Each row is one age group (assumed to be single years). method to use for adjustment of coefﬁcients kt . minperiod=2 . Possibilities are “bai” (Bai’s method computed using breakpoints in the strucchange package) and “bms” (method based on mean deviance ratios described in BMS). 21 upper age to include in ﬁt. "bai"). adjust = c("dt".lca. scale = FALSE. Default: all available years. “rates” and “deaths”.age adjust demogdata object of type “mortality”. it will choose the best ﬁtting period. restype = c("logrates". it will estimate any zero mortality rates using the same age group from nearby years."bms").age. breakmethod=c("bai". "deaths"). years=data$year. method to use for calculating residuals. max. "e ". ages to include in ﬁt. years=data$year. Defaults are “dxt” for bms() and “dt” for lca(). Default: all available ages up to max. max. ages=data$age. method to use for identifying breakpoints if chooseperiod=TRUE. chooseperiod minperiod breakmethod scale restype interpolate Details All mortality data are assumed to be in matrices of mortality rates within data$rate.

mort. It takes the name given by the series argument.lca.forecast(france. R. Maindonald.breakmethod="bai") fcast. 659-671.LC1 <.1)) plot(fcast.1)) plot(forecast(france. 56. 87.ylim=c(-11. Lee. and Carter. Functional time series containing estimated mortality rates from model Proportion of variance explained by model.bms) par(mfrow=c(1.mort.lca(fr.2)) plot(fr. Leonie Tickle.R. Mean deviance of total and base lack of ﬁt. Author(s) Heather Booth. L. fdm Examples france.jumpchoice="actual"). Journal of the American Statistical Association.bms(fr.LC1) par(mfrow=c(1.bms <. (2002) Applying Lee-Carter under conditions of variable mortality decline. Maindonald and Smith. J. The data stored as a functional time series object. Average deathrates across ﬁtting period First principal component in Lee-Carter model Coefﬁcient of ﬁrst principal component Functional time series of residuals. as described in Booth. (1992) Modeling and forecasting US mortality. H.bms$kt) . See Also forecast. John Maindonald and Rob J Hyndman.22 age year <series> ax bx kt residuals fitted varprop y mdev Ages from data object.1)) france. Population Studies. lca Matrix of mortality data as contained in data. Years from data object. and Smith.mort. L.D.years=1953:2 2..bms <..ylim=c(-11.. 325-336.adjust="e ") plot(france.LC1. References Booth.

or a forecast object of life expectancies (one per year).age = min(1 . "cohort"). ..expectancy with age= . Either period or cohort. Author(s) Rob J Hyndman . Default is the ﬁrst demogdata series in data. Where appropriate.) e (data.demogdata.age PI nsim . The function flife. Other arguments passed to simulate when producing prediction intervals. PI = FALSE. Name of mortality series to use.expectancy is primarily designed for forecast life expectancies and will optionally produce prediction intervals. PI = FALSE.. years = data$year. series = names(data$rate)[1]. age = min(data$age).. nsim = 5 . Number of simulations to use when computing a prediction interval. years = data$year. max. series years type age max. series=NULL. type = c("period". max.life. max(data$age))) flife.lca.fdm or forecast. it will package the results as a forecast object which makes it much easier to product nice plots of forecast life expectancies. series = NULL.expectancy 23 life. Vector indicating which years to use.. "cohort").age = NULL. max. or an object of class fmforecast such as the output from forecast.. Usage life. or an object of class fmforecast2 such as the output from forecast. . type = c("period". years = data$year.) Arguments data Demogdata object of type “mortality” such as obtained from read. nsim = 5 .fdmpr. type = c("period".expectancy Estimate life expectancy from mortality rates Description All three functions estimate life expectancy from lifetable. produce a prediction interval. Value Time series of life expectancies (one per year). "cohort"). The e function is a shorthand wrapper for flife. Maximum age for life table calculation.expectancy(data..expectancy(data. If TRUE.age = NULL. age = min(data$age). Age at which life expectancy is to be calculated.

e .expectancy(fr.fdm <. series = names(data$rate)[1]. Vector indicating which years to include in the tables.nsim=2 ) plot(e .lca(fr.age type Demogdata object such as obtained from read. Ages beyond this are combined. Type of lifetable: period or cohort.e (france.fcast) france.fdm) ## Not run: e .24 See Also lifetable Examples plot(life. Age for last row.jumpchoice="actual") france. Vector indicating which ages to include in table. years = data$year.forecast(france.mort. Default is the ﬁrst series in data\$rate.life.age = min(1 .expectancy(fr.ylab="Life expectancy") france.mort.mort). ages = data$age.type=’cohort’.f <. "cohort")) Arguments data series years ages max.LC <.years(fr.fdm(extract.demogdata. max.fdm or forecast.fcast <. forecast.expectancy(france.mort.years=195 :1997) france.fcast <. Usage lifetable(data. type = c("period". max(data$age)).LC.age=5 ) 6)) lifetable lifetable Construct lifetables from mortality rates Description Computes period and cohort lifetables from mortality rates for multiple years.fcast <. .years=195 :2 france.fcast.forecast(france.lca. Name of series to use.PI=TRUE.adjust="e ".fcast) ## End(Not run) life.

P. if ages takes a scalar value. Author(s) Heather Booth. In all cases. On the other hand. and Guillot. Heuveline. qx = mx /(1 + [(1 − ax )mx ]) as per Chiang (1984). However. For cohort lifetables. if ages= :1 and years=195 :2 1 .. But if ages is a vector of values. and Caswell. H. if ages= then lifetables of the birth cohorts for all years in years are computed. The number of deaths between exact ages x and x+1. then the cohorts are taken to be of that age in each year contained in years.expectancy . For example. then the cohorts are taken to be of those ages in the ﬁrst year contained in years. Number of years lived between exact age x and exact age x+1. there is a print method that constructs (and returns) the lifetables from the above components. Keyﬁtz. (2001) Demography: measuring and modeling population processes. The probability that an individual of exact age x will die before exact age x+1. Preston. Rob J Hyndman. Value Object of class “lifetable” containing the following components: label series age year mx qx lx dx Lx Tx ex Name of region from which data are taken. Warning: the code has only been tested for data based on single-year age groups. (1984) The life table and its applications. Number of years lived after exact age x. The radix is 1. only their components. Number of survivors to exact age x. M.H. Robert E Krieger Publishing Company: Malabar. Springer-Verlag: New York.. N. Blackwell See Also life. (2005) Applied mathematical demography. then lifetables of each age cohort in 1950 are computed. Remaining life expectancy at exact age x. John Maindonald and Timothy Miller References Chiang CL. Leonie Tickle. S. Name of series Ages for lifetable Period years or cohort years Death rate at age x. all years and all ages speciﬁed are included in the tables.lifetable Details 25 For period lifetables. Note that the lifetables themselves are not returned.

rm = TRUE.lca(fr. na.demogdata or smooth. Method for computing the median.lifetable(fr.clt <.age= . .LC) france. series = names(x$rate)[1]..type="cohort".demogdata Mean and median functions for data of class demogdata Description Computes mean or median of demographic rates for each age level. .fcast <.mort. transform = TRUE.lifetable(fr.fcast) plot(france. . Name of demogdata series to plot.years=195 ) mean.mort. "coordinate").demogdata :191 ) mean.rm method Demogdata object such as created using read.demogdata. Other arguments.f <.) ## S3 method for class ’demogdata’ median(x.. transform = TRUE.lt <.mort) plot(france. series = names(x$rate)[1]..forecast(france. Either "coordinate" for a coordinate-wise median.LC <.mort) france.print(lifetable(fr..) Arguments x series transform na. Value A list containing x=ages and y=mean or median rates.lt) lt199 <.f) # Birth cohort lifetables.type="cohort". Usage ## S3 method for class ’demogdata’ mean(x.lt.lifetable(france. or "hossjercroux" for the L1-median using the Hossjer-Croux algorithm..lt.. 19 -191 france..26 Examples france.year=199 )) france. method = c("hossjercroux". Should transform of data be taken ﬁrst? a logical value indicating whether NA values should be stripped before the computation proceeds. . years=19 # Partial cohort lifetables for 195 lifetable(fr.mort.

Examples plot(fr..default. Details The median function in the stats package is replaced by median.mort). 293-308.col=2) median Median Description Generic function for the median.. Usage median(. (1995) Generalized univariate signed rank statistics for testing and estimating a multivariate location parameter. and Croux.. Value Refer to speciﬁc methods. For numeric vectors.demogdata Arguments passed to speciﬁc methods.lwd=2) lines(median(fr.mort). 4. C.) Arguments . see the median function in the stats package. .mort) lines(mean(fr. Nonparametric Statistics. O. Author(s) Rob J Hyndman See Also median.lwd=2...median Author(s) Rob J Hyndman References 27 Hossjer.

fit) models(fr.years(fr.series="male") fr.28 models models Show model information for the forecast coefﬁcients in FDM models. .fcast) fr...forecast(fr.fdm or forecast.sm.short <.select=1:3) 6) Output from forecast.fit <.forecast(fr.fit <. Usage ## S3 method for class ’fmforecast’ models(object. See Also forecast.fit) models(fr. Examples fr.fdmpr. . select= . forecast. Author(s) Rob J Hyndman.short.fcast <. Other arguments. Description The models for the time series coefﬁcients used in forecasting fdm models are shown.. Value Nothing is returned.coherentfdm(fr.short) fr. all coefﬁcients are displayed. If select=0.fdm(fr.) Arguments object select .) ## S3 method for class ’fmforecast2’ models(object..fdm.fcast <..extract. Indexes of coefﬁcients to display.fdmpr.195 :2 fr.fcast. ..

5) Arguments mort fert mfratio Value Object of class “demogdata” with the following components: year age rate Vector of years Vector of ages List containing matrices of net migration numbers (not "rates") with with one age group per row and one column per year. pop type label Author(s) Rob J Hyndman See Also demogdata Examples ## Not run: require(addb) aus. based on the total population numbers.netmigration 29 netmigration Calculate net migration from mortality and fertility data Description Function to compute the net number of migrants in each year and for each age.netmigration(australia. mfratio = 1. In this case. “migration”.aus. Usage netmigration(mort. List containing matrices of populations in same form as rate and containing population numbers. label from mort$label Demogdata object of type "mortality" Demogdata object of type "fertility" Male-female ratio to be used in simulating births. Type of object. Names of matrices are the same as for mort$rate.fertility) plot(aus. fert.mig) ## End(Not run) . deaths and births in each year.mig <.

.names(x$rate)[1]."time". years=x$year.. What type of plot should be drawn.null(x$rate). main=NULL. pch = 1) Arguments x series datatype years ages max. series=ifelse(!is."depth".names(x$pop)[1]). Usage ## S3 method for class ’demogdata’ plot(x.. then each age is shown as a separate time series in a time plot. Alternative: “pop”. max. Name of demogdata object which contains series.age=max(x$age).type="time"."rate". ages=x$age.) ## S3 method for class ’demogdata’ points(.demogdata. years=x$year.names(x$pop)[1]). See plot for possible types.type=c("functions". . Maximum age to plot.null(x$rate). Main title for the plot.30 plot. Default: all available ages... Label for x-axis.. plot..demogdata or smooth. plot. followed by orange. xlab.demogdata plot.type="functions". If plot.names(x$rate)[1]. Label for y-axis."").."density"). transform=(x$type=="mortality"). datatype=ifelse(!is.type type main xlab ylab Demogdata object such as created using read.null(x$rate). type="l". and FALSE otherwise. ages=x$age. Default: the ﬁrst matrix within datatype.null(x$rate)."pop"). then years are plotted using a rainbow palette so the earliest years are red. max. Name of series to plot. Default: all available ages."rate".type=c("functions". Should a transformation of the data be plotted? Default is TRUE if the object contains mortality data and datatype="rate". green."depth". Default: all available years."density"). yellow. blue and indigo with the most recent years plotted in violet. datatype=ifelse(!is. Default “rate”. Type of plot: either “functions” or “time”.age transform plot. transform=(x$type=="mortality").demogdata Plot age-speciﬁc demographic functions Description If plot. ylab. .age=max(x$age). Vector indicating which years to plot.) ## S3 method for class ’demogdata’ lines(x. series=ifelse(!is."time". Vector indicating which ages to plot.

plot..demogdata.. In points. .2)) plot(aus. Value None.type="functions") plot. Author(s) Rob J Hyndman Object of class "errorfdm" generated by compare. Usage ## S3 method for class ’errorfdm’ plot(x.demogdata.) Arguments x transform . Plot errors on transformed scale or original scale? Plotting parameters .. Value None.fert. 31 Other plotting parameters. all arguments are passed to lines.plot.plot.demogdata. Plotting character.mort) par(mfrow=c(1.fert. transform = TRUE. Function produces a plot Author(s) Rob J Hyndman Examples plot(fr.type="time") plot(aus..errorfdm Plot differences between actuals and estimates from ﬁtted demographic model Description Function produces a plot of errors from a ﬁtted demographic model...errorfdm pch .

xlab2 = "Year".type=="function"). Output from forecast. .lca(extract..demogdata(fr.type="variance" produces a plot of the variance components. h = 1. plot.type="components" produces a plot of the basis functions and coefﬁcients with forecasts and prediction intervals for each coefﬁcient.type=="component").mort.compare.32 See Also compare. If plot. See details.ftsf (if plot. Function produces a plot . plot.lab xlab2 h ..fmforecast plot.type: plot.fmforecast Plot forecasts from a functional demographic modell Description Type of plot depends on value of plot. "component".) Arguments x plot.mort.error <.2 )) plot(fr.. x-axis label for coefﬁcient time series.type="function" produces a plot of the forecast functions.fit..years(fr.error) plot.ftsm.type=="variance") or plot. vcol = 1:4. "variance"). Value None. Colors to use if plot. Other arguments are passed to plot.years=1921:198 )) fr.demogdata Examples fr.lab = "Mean". plot (if plot. plot.demogdata (if plot.type="variance".type="variance". forecast(fr.type = c("function". mean. h gives the forecast horizon for which the variance is plotted. Label for mean component. Usage ## S3 method for class ’fmforecast’ plot(x.type vcol mean.fit <. Type of plot. forecast.fdm or lca.

plot.fcast) plot(france.fcast <.) Arguments x years main xlab ylab .mort)) plot(france. ylab = "Expected number of years left". Additional arguments passed to plot. . forecast.fcast.lifetable Plot life expectancy from lifetable Description plots life expectancy for each age and each year as functional time series.fdm Examples france.fds. years = x$year.. Value None. Years to plot. Label for x-axis.. . years = x$year.lifetable Author(s) Rob J Hyndman See Also fdm.fcast.) ## S3 method for class ’lifetable’ lines(x.. ... main. lca. Default: all available years. Usage ## S3 method for class ’lifetable’ plot(x.forecast(fdm(fr. xlab = "Age". Author(s) Rob J Hyndman Output from lifetable.."v") 33 plot. Main title."c") plot(france. Label for y-axis.

lt <.sim(mort. simulation uses resampled errors rather than normally distributed errors. mfratio=1.LC <.h.sim pop. Usage pop. .fcast <. fertility and migration.lt. fert=NULL.expectancy. 5. Author(s) Rob J Hyndman. Male-female ratio used in distributing births.f.lifetable(france.forecast(france. firstyearpop. bootstrap=FALSE) Arguments mort fert mig firstyearpop N mfratio bootstrap Forecasts of class fmforecast2 for mortality.lca(fr. Forecasts of class fmforecast for female fertility. The arrays are of dimension (p.lt. h is the forecast horizon and N is the number of simulated sample paths.34 See Also life.years=2 1 ) pop.mort) france.f <.lt) france.N) where p is the number of age groups. Value A list of two arrays containing male and female future simulated population values.lifetable(fr. Population for ﬁrst year of simulation. mig=NULL.sim Population simulation Description Simulate future sample paths of a population using functional models for mortality. Number of sample paths to simulate. Examples france. lifetable. Forecasts of class fmforecast2 for net migration.mort) plot(france.LC) france. If TRUE.fcast) plot(france. N=1 .

demogdata(file.fmforecast2. Name of area from which the data are taken.fertility. 545) # Fit models mort.fit) mig.fit) # Simulate aus.fcast. “fertility” or “migration”.mfratio=1.demogdata Read demographic data and construct demogdata object Description Read data from text ﬁles and construct a demogdata object suitable for plotting using plot. Usage read. All values greater than max.fert. label. Filename containing population numbers.demogdata and ﬁtting an LC or BMS model using lca or an FDA model using fdm.mx will be set to max.mig. Character string showing type of demographic series: either “mortality”. lambda) Arguments file popfile type label max.195 :2 2).sim <.demogdata(set.fcast.upperage(australia. .sm) mig.1 )) fert.netmigration(set.sim(mort.sm) fert.forecast(mig.195 :2 2)) aus.mx.fit <.smooth.fit) fert.upperage(extract. skip = 2.aus.mig) # Produce forecasts mort. type. simulate. popskip = skip. Number of lines to skip at the start of file.coherentfdm(mort.smooth.fcast <.fcast <.fcast <.forecast(fert. max.mx = 1 .demogdata See Also simulate.fmforecast.read.mx skip Filename containing demographic rates. Examples ## Not run: require(addb) # Construct data objects mort.fit <. Maximum allowable value for demographic rate. popfile.pop.1 ).coherentfdm(aus.demogdata(extract.mig <.sm <.fertility.sm <.fit <.fcast.forecast(mort.years(australia.years(aus.australia) ## End(Not run) 35 read.fdm(fert.

If popfile contains the Exposures and file contains the Mx rates from the HMD. Value Object of class “demogdata” with the following components: year age rate pop type label Author(s) Rob J Hyndman See Also demogdata Examples ## Not run: norway <. A list of the same form as rate but containing population numbers instead of demographic rates. Details All data are assumed to be text ﬁles with the ﬁrst column containing the year of observation and the second column containing the age level. label .read.org. read. All remaining columns are assumed to be demographic rates for sections of the population. If missing. Population data are assumed to have the same format but with population numbers in place of rates. Note that this format is what is used by the Human Mortality Database http: //www.txt". "Exposures_1x1.4 (for fertility) and 1 (for migration).demogdata Box-Cox transformation parameter to be used in modelling and plotting.36 popskip lambda Number of lines to skip at the start of popfile. then everything will work seamlessly. The ﬁrst row of the text ﬁle is assumed to contain the names of each column. 0. type="mortality". Type of object: “mortality”.txt".demogdata("Mx_1x1.mortality. label="Norway") ## End(Not run) Vector of years Vector of ages A list containing one or more rate matrices with one age group per row and one column per year. default values are 0 (for mortality). “fertility” or “migration”.

mort) plot(residuals(fit1)) plot(fitted(fit1)) ’fdm’ ’lca’ ’fdm’ ’lca’ Output from fdm or lca.. fitted.) Arguments object .lca produce an object of class “fts” containing the ﬁtted values from the model.. bms Examples fit1 <...) ## S3 method for class fitted(object... Other arguments.fdm and residuals. Author(s) Rob J Hyndman. See Also fdm. Value residuals.) ## S3 method for class fitted(object...fdm 37 residuals. .fdm and fitted.lca produce an object of class “fmres” containing the residuals from the model. These functions extract the relevant information from the ﬁt object..lca(fr. it is useful to inspect the residuals or plot the ﬁtted values.) ## S3 method for class residuals(object...fdm Compute residuals and ﬁtted values from functional demographic model or Lee-Carter model Description After ﬁtting a Lee-Carter model or functional demographic model. lca.. Usage ## S3 method for class residuals(object...residuals.

ratio(data) Arguments data Demogdata object of type “mortality” such as obtained from read.short <.upperage(data. sex.upperage(fr. or an object of class fmforecast such as the output from forecast.set. Ages beyond this are combined into the upper age group. .85) Demogdata object such as created using read.age=1 ) Arguments data max.ratio set.age Value Demogdata object with same components as data but with a subset of ages.demogdata.ratio Compute sex ratios from mortality rates Description Calculates the Male/Female ratios from historical or forecasted mortality rates.lca. Usage sex.38 sex.mort. Description Computes demographic rates by combining age groups. max. Author(s) Rob J Hyndman Examples france. Upper age group.demogdata or smooth.upperage Combine the upperages of a demogdata object.demogdata.fdm or forecast. Usage set.

Typically.) ## S3 method for class ’fmforecast2’ simulate(object.. will adjust the model variance by the ratio of the empirical and theoretical variances for one-step forecasts. adjust. NULL will not change the random generator state. bootstrap=FALSE.fmforecast. Description This function will simulate future sample paths given forecasting models from a functional demographic model such as those obtained using forecast. Number of sample paths to simulate. Usage ## S3 method for class ’fmforecast’ simulate(object.fmforecast Value Functional time series of sex ratios. The default. If TRUE.. . seed=NULL.fdm or forecast.ratio(fr.mort).modelvar If TRUE.) Arguments object nsim seed bootstrap adjust.fmforecast Simulate future sample paths from functional demographic model forecasts.seed before simulating the time seriers.fdm.. Other arguments passed to simulate. nsim=1 . this is output from forecast. .simulate. . .modelvar=TRUE. or a list of arrays containing the future simulated values (in the case of a fmforecast2 object).. Either NULL or an integer that will be used in a call to set.fdmpr.. Author(s) Rob J Hyndman Examples plot(sex. simulation uses resampled errors rather than normally distributed errors.ylab="Sex ratios (M/F)") 39 simulate.. Object of class fmforecast. Value An array containing the future simulated values (in the case of a fmforecast object).

fertility = "cspline".method="ets") france. Power transformation for age variable before smoothing. mortality = . Default is 0.simulate(france.forecast(france.fit.4 for mortality data and 1 (no transformation) for fertility or migration data.nsim=1 ## End(Not run) smooth.lca. Default is single years over a slightly greater range than the unsmoothed data.sm) france.var = "empirical") Arguments data method Demogdata object such as created using read.fcast2.fcast2 <.sim <. power = switch(data$type. Examples ## Not run: france. Lower age for monotonicity if method=="mspline".fcast <. "spline" (unconstrained regression splines). b = 65. migration = "loess"). span = . fertility = 1.grid power b .2. age.coherentfdm(fr. "cspline" (concave regression splines). k = 3 . Above this.40 Author(s) Rob J Hyndman.5 . method = switch(data$type.nsim=1 ) france.order=2) france.demogdata Create smooth demogdata functions Description Smooth demogdata data using one of four methods depending on the value of method Usage smooth.sim2 <.4. weight = data$type != "migration". forecast. obs. lambda = 1e-1 .mort.ftsm. Possibilities: "mspline" (monotonic regression splines).demogdata ) smooth. Method of smoothing. Ages to use for smoothed curves.fdm. interpolate = FALSE.fit2. the smooth curve is assumed to be monotonically increasing. migration = 1). "loess" (local quadratic using loess).fit2 <.forecast(france.grid.5 ) france. mortality = "mspline".demogdata(data.demogdata.fit <.fcast.simulate(france. See Also forecast. age. forecast.fdm(fr.

Smoothness controlled by lambda. Weight matrices are also added to the object showing the inverse variances of the estimated smooth curves.sm. The curves are monotonically increasing for age greater than b. method="mspline" Weighted penalized regression splines with a monotonicity constraint.mort. Methodology based on Wood (1994). method="spline" Unconstrained weighted penalized regression splines. Methodology based on He and Ng (1999).smooth.demogdata(extract. Code calls cobs for the basic computations. Smoothness controlled by k. Ignored if method=="loess". uses weighted smoothing.years=198 . If interpolate==TRUE. Possible values: “empirical” or “theoretical”. Details The value of method determines the type of smoothing used.pch=1) lines(france. Code calls loess for the basic computations.col=2) .demogdata k span lambda interpolate weight obs.years(fr. method="cspline" Weighted regression B-splines with a concavity constraint. Code calls gam for the basic computations.sm) plot(fr. If TRUE. Method for computing observational variance.sm <.var 41 Number of knots to use for penalized regression spline estimate. method="loess" Weighted locally quadratic regression.mort. Penalty for constrained regression spline if method=="cspline". Equivalent to "mspline" but with b=Inf. Span for loess smooth if method=="loess".type="p".smooth. Author(s) Rob J Hyndman Examples france. Value Demogdata object identical to data except all rate matrices are replaced with smooth versions and pop matrices are replaced with disaggregated population estimates obtained using monotonic spline interpolation applied to the cumulative population data.years=198 . Smoothness controlled by span. a linear interpolation is used instead of smoothing.198 :1997)) plot(france.

Usage ## S3 method for class ’fdm’ summary(object...mort) summary(fit1) summary(fit2) summary(fit3) Output from fdm or lca. See Also fdm.) Arguments object .42 summary.breakmethod="bai") fit3 <..fdm(fr.mort) fit2 <...bms(fr... bms.lca(fr.fdm summary. Value None. Author(s) Rob J Hyndman.fdm Summary for functional demographic model or Lee-Carter model Description Summarizes a basis function model ﬁtted to age-speciﬁc demographic rate data.demogdata Examples fit1 <.mort. lca. Other arguments. It returns various measures of goodness-of-ﬁt.) ## S3 method for class ’lca’ summary(object. compare. ..

Number of simulations to use when computing a prediction interval. Value If data are of class demogdata.PI=TRUE.fert)) ausfert..nsim=5 )) ..demogdata. Other arguments passed to simulate when producing prediction intervals.. . nsim=5 Arguments data PI nsim . If data are from forecast.) Demogdata object of type "fertility" such as obtained from read. Usage tfr(data. .fdm..fcast. PI=FALSE.fert)) plot(tfr(ausfert.forecast(fdm(aus.fdm.tfr 43 tfr Compute total fertility rate from fertility rates Description Compute total fertility rates from age-speciﬁc fertility rates contained in a demogdata object. produce a prediction interval. forecast. Author(s) Rob J Hyndman See Also fdm Examples plot(tfr(aus. the function returns a time series of fertility rates. If TRUE. the function returns an object of class forecast containing point forecasts and (optionally) prediction intervals.fcast <.

1.fmforecast2() updates fdmpr forecasts..fcast <.fmforecast Updating functional demographic models and coherent functional demographic models.coherentfdm(fr. Value A list of the same class as object.mort.forecast(Arima(france.2)+drift france.fcast <.fit <.sm.fcast) fr. Description update.extract..order=2) france. Usage ## S3 method for class ’fmforecast’ update(object.2].fdmpr Examples france.fmforecast update.44 update.fcast$coeff[[2]] <. or net migration numbers.fdm(fr.fdmpr which has been subsequently modiﬁed with new coefﬁcient forecasts.fit <.1.fdm which has been subsequently modiﬁed with new coefﬁcient forecasts.fdm. The argument object is the output from forecast.short) fr. order=c( . forecast. h=5 .195 :2 fr..5 ) # Replace first coefficient model with ARIMA( .2).fit) 6) Output from either fdm or coherentfdm.years(fr. Author(s) Rob J Hyndman.. .short <.fmforecast() updates fdm forecasts.) ## S3 method for class ’fmforecast2’ update(object.. level=8 ) france..forecast(fr. Extra arguments currently ignored. These new forecasts are used when re-calculating the forecast of the mortality or fertility rates.forecast(france. . include. The argument object is the output from forecast.drift=TRUE). update.fcast <. See Also forecast.update(france.fit$coeff[. .fit.) Arguments object .

level=8 ) fr.update(fr.forecast(ets(fr.update.fcast <. h=5 .2)) plot(fr. damped=TRUE).fit$product$coeff[.fmforecast par(mfrow=c(1.fcast$male) 45 .2].fcast$male) # Replace first coefficient model in product component with a damped ETS model: fr.fcast) plot(fr.fcast$product$coeff[[2]] <.

spline. 37. 20. 3 bms. 13 forecast. 31. 11 forecast. 2 e (life. 14. 10 extract. 8 extract. 13. 10 fdm.lca. 44 ∗Topic package 46 demography-package. 23 forecast. 7 fdm. 24 mean. 33 pop.demogdata. 37.fdm. 6 demogdata. 42 tfr. 24. 35. 28.years. 20 breakpoints.mort. 32. 41 . 12 gam. 5. 4 smooth. 29. 22. 43 update.ratio.lca (residuals.demogdata. 12. 8. 20 life. 16 ∗Topic hplot plot. 14.fmforecast. 39. 41 coherentfdm.lca.Index ∗Topic data aus.splinefun (cm. 4 cobs. 42–44 fitted. 17. 6. 38. 32. 44 forecast. 26 median. 16 ftsm. 42 bms (lca).upperage. 38 ∗Topic models coherentfdm.fdm). 33.fdm. 7. 23. 6 compare. 7. 43.spline). 2 ∗Topic smooth cm. 8. 14. 32 ∗Topic manip combine. 14. 14.demogdata.expectancy (life. 27 models. 19. 13. 5. 14. 5 compare.fdm. 8. 15. 15.expectancy). 37 sex. 2 demography-package.expectancy). 42 demogdata.sm (fr. 10 extract. 32.years. 21–24. 11. 44 combine. 39 summary. 40 aus. 14 forecast. 44 forecast. 15 isfe. 11. 38–40. 19 lca.demogdata. 21 cm.ages. 16 fr.fmforecast.mort).expectancy. 23.fert. 7. 31 plot.errorfdm.demogdata.fert.mx.fdm).sim.ages. 36 demography (demography-package). 4 cm. 35 set.fmforecast. 28. 30 plot.fdmpr.demogdata.fdmpr. 23 lifetable. 33. 40 forecast. 20.demogdata. 3 fr. 10 hmd.ftsm. 37 fitted. 37 flife. 29 read.spline.fdm. 40 fr. 15. 5.mort. 38 simulate. 28 plot.lifetable. 34 residuals. 17 netmigration.fdm (residuals. 23 extract.demogdata. 13.

fdm. 30. 19 lca.demogdata. 33. 44 47 update.demogdata (mean. 38.upperage.mx). 40 spline. 44 xy.lca (plot. 4 summary. 19. 32 plot. 23. 43 residuals. 4 splinefun.fmforecast2. 33 loess. 38 sex.fmforecast. 32. 40.fdm). 25. 35.demogdata). 30 lines.ftsf. 33. 42 tfr. 17 isfe. 15.demogdata. 42 summary.fmforecast.sim. 32 plot. 31 plot. 27. 35 simulate. 26 models. 33 points. 43 update.demogdata (plot.fmforecast). 26. 19. 30 pop.fmforecast). 20. 38. 27 median. 40.lifetable). 30. 35 plot. 34 lines. 28 netmigration.demogdata.errorfdm. 30.fmforecast2 (update. 24. 34 read.demogdata. 35. 35. 10. 39 smooth. 17 hmd. 30. 32.fds. 41 mean.fmforecast). 8.ratio.lifetable (plot.coords.fdm).INDEX hmd (hmd.lca (residuals. 26 median. 32 plot. 16. 9.demogdata).fdm. 8. 7. 39 simulate. 37 set.lca (summary.lifetable. 32 plot. 4 .fmforecast2 (simulate. 29 plot.demogdata. 8. 33 plot. 37 residuals. 24.mx.fmforecast.demogdata (plot.demogdata). 37. 23. 10. 27 median. 17. 42 life. 26.expectancy. 34 lifetable. 24. 38 simulate. 17.

- IJF11 Carson Airtravel ForecastUploaded byJoão Miguel Sarmento
- Data Description.pdfUploaded bySobaNa Kanthi
- Chapter 2 Practice AnswersUploaded byZeyad Moustafa
- WASTEUploaded bysiddharth
- Approaches to Human Resource PlanningUploaded byJay Khadka
- STAT MCTUploaded bySwami Gurunand
- FIX BHS INGGRIS OTW LANCAR BISMILLAH.pptxUploaded byAyu Pratiwi
- Chapter 14 StatisticsUploaded byMuzaFar
- Week 05 Part 2Uploaded byJane Doe
- Math-10-Quarter-4.docxUploaded byEdwin Sartin
- Inner.pdfUploaded byShah Maqsumul Masrur Tanvi
- Forecasting TemplateUploaded bySatya
- Sales ForecastingUploaded byBinaya Pradhan
- Combining National and Constituency Polling for ForecastingUploaded bysfsdsfsd
- 2Uploaded byapi-246358110
- Environmental analysis has several benefits like those mentioned below.docxUploaded bysadathnoori
- Delphi Technique Rowe WrightUploaded byweran
- Marwala's MSc DissertationUploaded byBall Sutta
- Cashflow ForecastUploaded byMagdy Ghobashy
- Ch_01_Wooldridge_6e_PPT_Updated.pptUploaded byTạ Khánh Linh
- Aggregate Planning and ForecastingUploaded byvmktpt

- La Funcion y Formacion Del E-moderatorUploaded byIvo Rodrigues
- 6 Memoria AtkinsonUploaded byIvo Rodrigues
- 5 - Taxonomia Dos Objetivos Educacionais - Taxonomia de BloomUploaded byPoli Evas
- Cross - LocalizaçãoUploaded byIvo Rodrigues
- Guião de Trabalho - Entrevista e Análise de ConteúdoUploaded byIvo Rodrigues
- Estatuto Do Aluno e Ética Escolar 2012Uploaded byramiromarques
- Estatuto Do Aluno e Ética Escolar 2012Uploaded byramiromarques
- 5 estratégias Mindfulness.pdfUploaded byIvo Rodrigues
- Tutorial Classroom Para ProfessorUploaded byDaniel Carvalho
- Aprendizagem Como CritérioUploaded byAdelina Silva
- Google Earth as a Not Just Geography Education ToolUploaded byIvo Rodrigues
- The Verb TO BEUploaded byzorzica
- CONSTRUCTIVISM, TECHNOLOGY, AND THE FUTURE OF CLASSROOM LEARNINGUploaded byManuela Ivancu
- Principle Component AnalysisUploaded bymatthewriley123
- SpuRsUploaded byIvo Rodrigues
- Naturaleza de La Investigación...LukasSantiago(Parte 1)Uploaded byIvo Rodrigues
- Imp - Factor AnalysisUploaded byIvo Rodrigues
- nleqslvUploaded byIvo Rodrigues
- Estatuto Do Aluno e Ética Escolar 2012Uploaded byramiromarques
- LaTeXMoodle_2010_10_01Uploaded bySandra Veçoso
- Glossário de estatística - completoUploaded bytamosai

- BOQ and Materials for BuildingsUploaded byDarshan Prashant
- Dissertation Galek 2013Uploaded byKamel Fedaoui
- Face Liveness Detection for Biometric Antispoofing Applications using Color Texture and Distortion Analysis FeaturesUploaded byEditor IJRITCC
- Advanced ThermodynamicsUploaded byYashwanth Krishnan
- 0751Testing SingleUploaded byJanesha
- Implementing Lockout Function With IEC61850Uploaded byVankurd
- Echocardiography Board ReviewUploaded bykhlnguyen
- contest05.pdfUploaded bySahabudeen Salaeh
- Ferguson T.S. Game sUploaded bymindflores
- 3. Simulation Analysis of SVPWM Inverter Fed Induction Motor DrivesUploaded byAbdul Basith Atsan
- Pw4000-100_opencowl Inspection GuideUploaded bygayathrisicwai
- ConstructionUploaded byNuha Hawariah
- 01-2006-DARCIS-s.pdfUploaded bytazzorro
- Physics for You 201405Uploaded byamitnishant94
- Contracts 2015Uploaded byakshaymehra
- Cathodic Protection - IntroductionUploaded byRaje Jay
- How to Test 10G Ethernet WhitePaperUploaded byTheduyet Pham
- Distortion Reduction in Gear by Simple Heat Treatment Process by Simple FixtureUploaded byVireshVerma
- A Brief Guide to the Buddipole System_revpUploaded bydfas-eu
- BS 874-3.2.pdfUploaded byAnitha Mj
- Cagi Data Sheet_ts32sc-600lacUploaded bylletsumen
- R B Woodward - A Total Synthesis of Colchicine - Harvey Lecture 1963Uploaded bydokuscribd
- CAT Course FeedUploaded byChirag Jain
- Adjectives Used in Comparisons- Part 1Uploaded bybáh_lee
- 155493-1CDUploaded byeduardo robles gasca
- Log Tables and Their OperationsUploaded byUday Prakash Sahu
- K Means Clustering in R Example – Learn by MarketingUploaded byAri Clecius
- Literary Lab Pamphlet 5Uploaded byhail2pigdum
- PROPAGATION MODEL CALIBRATION.pdfUploaded byHatem MOKHTARI
- 34401-usersUploaded byeungkyu