pop.write.projection.summary: Writing Projection Summary Files

Description Usage Arguments Details Note Author(s) See Also Examples

Description

The function creates ASCII files containing projection summaries, such as the median, the lower and upper bound of the 80 and 95% probability intervals, respectively.

Usage

1
2
write.pop.projection.summary(pop.pred, what = NULL, expression = NULL, 
    output.dir = NULL, ...)

Arguments

pop.pred

Object of class bayesPop.prediction.

what

A character vector specifying what kind of projection to write. Total population is specified by “pop”. Vital events are specified by “births”, “deaths”, “sr” (survival rate), “fertility” and “pfertility” (percent fertility). Each of these strings can (some must) have a suffix “sex” and/or “age” if sex- and/or age-specific measure is desired. For example, “popage”, “birthssexage”, “deaths”, “deathssex”, are all valid values. Note that for survival, only “srsexage” is allowed. For percent fertility, only “pfertilityage” is allowed. Suffix “sex” cannot be used in combination with “fertility”. Moreover, “fertility” (without age) corresponds to the total fertility rate. If the argument is NULL, all valid combinations are used. The argument is not used if expression is given. Note that vital events can be only used if the prediction object contains vital events, i.e. if it was generated with the keep.vital.events argument being TRUE (see pop.predict).

expression

Expression defining the measure to be written. If it is not NULL, argument what is ignored. For expression syntax see pop.expressions. The country components of the expression should be given as “XXX”.

output.dir

Directory in which the resulting files will be stored. If NULL pop.pred$output.directory is used.

...

These are arguments used if expression is given: file.suffix defines the file suffix; expression.label (defaults to the expression) is put as the first line in the resulting file; logical include.observed determines if observed data should be included; integer digits defines the number of decimal places in the resulting file.

Details

There is one file created per value of what, or expression, called ‘projection_summary_suffix.csv’, where suffix is either what or, if an expression is given, the value of file.suffix. It is a comma-separated table with the following columns:

If expression is given, expression.label (by default the full expression) is written as the first line of the file starting with #. The file contains one line per country, and possibly sex and age.

Note

If the expression argument is used, the same applies as for pop.map in terms of Performance and Caching.

Author(s)

Hana Sevcikova

See Also

pop.predict, pop.map, pop.expressions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
outdir <- tempfile()
dir.create(outdir)
sim.dir <- file.path(find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir=sim.dir, write.to.cache=FALSE)

# proportion of 65+ years old to the whole population
write.pop.projection.summary(pred, expression="PXXX[14:27] / PXXX", file.suffix="age65plus", 
    output.dir=outdir, include.observed=TRUE, digits=2)
    
# various measures
write.pop.projection.summary(pred, what=c("pop", "popsexage", "popsex"),
    output.dir=outdir)

unlink(outdir, recursive=TRUE)

bayesPop documentation built on Oct. 30, 2019, 9:57 a.m.