pop.scale.prediction | R Documentation |
Functions scale given sex- and age-specific population counts for each location and year, so that the sum of the scaled counts over all locations matches the given target for each year, sex and age. Function scale.pop.prediction
creates a new prediction object that contain the scaled trajectories. Function write.scaled.pop
writes a file containing the scaled statistics for each location, year, sex and age.
pop.scale.prediction(pop.pred, target.file, output.dir,
target.code = NULL, variant.name = "mean",
target.id.column = "country_code", stat = "mean",
exclude.codes = NULL, verbose = TRUE)
write.scaled.pop(pop.pred, target.file,
output.file = "adjusted_population.txt", target.code = NULL,
variant.name = "mean", target.id.column = "country_code",
output.id.column = "reg_code", stat = "mean",
exclude.codes = NULL, verbose = TRUE)
pop.pred |
Object of class |
target.file |
Comma-delimited file containing the summary statistics of the aggregated targets. For example, if locations in |
output.dir |
Directory to write the scaled projection into. |
target.code |
If the |
variant.name |
If the |
target.id.column |
Name of the column in |
stat |
Summary statistics to use for the scaling. By default, the scaling shifts are determined by comparing the means of the trajectories with the targets. |
exclude.codes |
Vector of location codes that should be excluded from the scaling. |
output.file |
File name to write the scaled sumary statistics into. |
output.id.column |
Column name of the unique identifier of the locations in the output file. |
verbose |
Logical switching processing info on and off. |
These functions can be used if it is necessary to scale the population distribution so that a summary statistics of the sum of the locations matches some given targets. For example, if states should sum up to a given country projection. Thus, its use is meant to be mainly for subnational projections.
The scaling is done for each sex and age, and the scaling proportions are determined by the population sizes within each sex and age group.
The function scale.pop.prediction
creates a new prediction object, saved into the directory given by output.dir
. It contains adjusted population trajectories, as well as recomputed quantiles. Note however that only population quantities are affected by this scaling. There is no change to vital events or rates.
Function write.scaled.pop
derives the necessary shifts for the scaling and stores the adjusted summary statistics into a file. It does not create any new projection object.
Function scale.pop.prediction
returns an object of class bayesPop.prediction
containing the scaled predictions. Function write.scaled.pop
returns the name of the file that it created.
Hana Sevcikova
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.