Description Usage Arguments Details Value Author(s) References See Also Examples
The function generates trajectories of probabilistic population projection for all countries for which input data is available, or any subset of them.
1 2 3 4 5 6 7 8 9 10 11 12 13  pop.predict(end.year = 2100, start.year = 1950, present.year = 2020,
wpp.year = 2019, countries = NULL,
output.dir = file.path(getwd(), "bayesPop.output"),
inputs = list(popM=NULL, popF=NULL, mxM=NULL, mxF=NULL, srb=NULL,
pasfr=NULL, patterns=NULL, migM=NULL, migF=NULL,
e0F.file=NULL, e0M.file=NULL, tfr.file=NULL,
e0F.sim.dir=NULL, e0M.sim.dir=NULL, tfr.sim.dir=NULL,
migMtraj = NULL, migFtraj = NULL),
nr.traj = 1000, keep.vital.events = FALSE,
fixed.mx = FALSE, fixed.pasfr = FALSE,
lc.for.hiv = TRUE, lc.for.all = TRUE,
my.locations.file = NULL, replace.output = FALSE,
verbose = TRUE, ...)

end.year 
End year of the projection. 
start.year 
First year of the historical data. 
present.year 
Year for which initial population data is to be used. 
wpp.year 
Year for which WPP data is used. The functions loads a package called wppx where x is the 
countries 
Array of country codes or country names for which a projection is generated. If it is 
output.dir 
Output directory of the projection. If there is an existing projection in 
inputs 
A list of file names where input data is stored. It contains the following elements (Unless otherwise noted, these are tab delimited ASCII files; Names of default datasets from the corresponding wpp package which are used if the corresponding element is

nr.traj 
Number of trajectories to be generated. If this number is smaller than the number of available trajectories of the probabilistic components (TFR, life expectancy and migration), the trajectories are equidistantly thinned.
If all of those components contain less trajectories than 
keep.vital.events 
Logical. If 
fixed.mx 
Logical. If 
fixed.pasfr 
Logical. If 
lc.for.hiv 
Logical controlling if the modified LeeCarter method should be used
for projection of mortality rates for countries with HIV epidemics. If 
lc.for.all 
Logical controlling if the modified LeeCarter method should be used
for projection of mortality rates for all countries. If 
my.locations.file 
Name of a tabdelimited ascii file with a set of all locations for which a projection is generated. Use this argument if you are projecting for a country/region that is not included in the standard 
replace.output 
Logical. If 
verbose 
Logical controlling the amount of output messages. 
... 
Additional arguments passed to the underlying function. These can be 
The population projection is computed using the Cohort Component method and is based on an algorithm used by the United Nation Population Division (see also Sevcikova et al (2015) in the References below). For each country, one projection is calculated for each trajectory of male and female life expectancy, TFR and possibly migration. This results in a set of trajectories of population projection which forms its posterior distribution. The trajectories of life expectancy and TFR can be given either in its binary form generated by the packages bayesLife and bayesTFR, respectively (as directories e0M.sim.dir
, e0F.sim.dir
, tfr.sim.dir
of the inputs
argument), or they can be given as ASCII tables in csv format, see above. The number of trajectories for male and female life expectancy must match, as does for male and female migration.
The projection is generated sequentially country by country. Results are stored in a subdirectory of output.dir
called ‘prediction’. There is one binary file per country, called ‘totpop_countryx.rda’, where x is the country code. It contains six objects: totp
, totpf
, totpm
(trajectories of total population, agespecific female and agespecific male, respectively), totp.hch
, totpf.hch
, totpm.hch
(the UN halfchild variant for total population, agespecific female and agespecific male, respectively). Optionally, if keep.vital.events
is TRUE
, there is an additional file per country, called ‘vital_events_countryx.rda’, containing the following objects: btm
, btf
(trajectories for births by age of mothers for male and female child, respectively), deathsm
, deathsf
(trajectories for agespecific male and female deaths, respectively), asfert
(trajectories of agespecific fertility), mxm
, mxf
(trajectories of male and female agespecific mortality rates), migm
, migf
(if used, these are trajectories of male and female agespecific migration), btm.hch
, btf.hch
, deathsm.hch
, deathsf.hch
, asfert.hch
, mxm.hch
, mxf.hch
(the UN halfchild variant for age and sexspecific births, deaths, fertility rates and mortality rates). An object of class bayesPop.prediction
is stored in the same directory in a file ‘prediction.rda’. It is updated every time a country projection is finished.
See pop.trajectories
for extracting trajectories.
To access a previously stored prediction object, use get.pop.prediction
.
Object of class bayesPop.prediction
with the following elements:
base.directory 
Full path to the base directory 
output.directory 
Subdirectory relative to 
nr.traj 
The actual number of trajectories of the projections. 
quantiles 
Threedimensional array of projection quantiles (countries x number of quantiles x projection periods). The second dimension corresponds to the following quantiles: 0.025,0.05,0.1,0.25,0.5,0.75,0.9,0.95,0.975. 
traj.mean.sd 
Threedimensional array of projection mean and standard deviation (countries x 2 x projection periods). First and second matrix of the second dimension, respectively, is the mean and standard deviation, respectively. 
quantilesM, quantilesF 
Quantiles of male and female projection, respectively. Same structure as 
traj.mean.sdM, traj.mean.sdF 
Same as 
quantilesMage, quantilesFage 
Fourdimensional array of agespecific quantiles of male and female projection, respectively (countries x age groups x number of quantiles x projection periods). The same quantiles are used as in 
quantilesPropMage, quantilesPropFage 
Array of agespecific quantiles of male and female projection, respectively, divided by the total population. The dimensions are the same as in 
estim.years 
Vector of time for which historical data was used in the projections. 
proj.years 
Vector of projection time periods starting with the present period. 
wpp.year 
The wpp year used. 
inputs 
List of input data used for the projection. 
function.inputs 
Content of the 
countries 
Matrix of countries for which projection exists. It contains two columns: 
ages 
Vector of age groups. 
cache 
This component is added by 
write.to.cache 
Logical determining if 
is.aggregation 
Logical determining if this object is a result of 
Hana Sevcikova, Thomas Buettner, based on code of Nan Li and helpful comments from Patrick Gerland
H. Sevcikova, A. E. Raftery (2016). bayesPop: Probabilistic Population Projections. Journal of Statistical Software, 75(5), 129. doi:10.18637/jss.v075.i05
A. E. Raftery, N. Li, H. Sevcikova , P. Gerland, G. K. Heilig (2012). Bayesian probabilistic population projections for all countries. Proceedings of the National Academy of Sciences 109:1391513921.
P. Gerland, A. E. Raftery, H. Sevcikova, N. Li, D. Gu, T. Spoorenberg, L. Alkema, B. K. Fosdick, J. L. Chunn, N. Lalic, G. Bay, T. Buettner, G. K. Heilig, J. Wilmoth (2014). World Population Stabilization Unlikely This Century. Science 346:234237.
H. Sevcikova, N. Li, V. Kantorova, P. Gerland and A. E. Raftery (2015). AgeSpecific Mortality and Fertility Rates for Probabilistic Population Projections. arXiv:1503.05215. http://arxiv.org/abs/1503.05215
pop.trajectories.plot
, pop.pyramid
, pop.trajectories
, get.pop.prediction
, age.specific.migration
1 2 3 4 5 6 7 8 9  ## Not run:
sim.dir < tempfile()
# Countries can be given as a combination of numerical codes and names
pred < pop.predict(countries=c("Netherlands", 218, "Madagascar"), nr.traj=3,
output.dir=sim.dir)
pop.trajectories.plot(pred, "Ecuador", sum.over.ages=TRUE)
unlink(sim.dir, recursive=TRUE)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.