peak.probability | R Documentation |
For a given indicator and a country, the function computes the probability of a peak happening before a given year, as well as a range of years between which a peak happens with given probability.
peak.probability(pop.pred, country = NULL, expression = NULL, year = NULL,
pi = 95, verbose = TRUE, ...)
pop.pred |
Object of class |
country |
Name or numerical code or ISO-2 or ISO-3 character code of a country. If given, population is used as an indicator and the |
expression |
Expression defining an indicator. For syntax see |
year |
Used for computing the probability of a peak happenning before |
pi |
Probability between 0 and 100. Used for selecting a range of years between which a peak happens with probability given by this argument. |
verbose |
Logical. If |
... |
Additional arguments passed to the underlying functions. If |
Given an indicator, the function computes two quantities:
probability that the indicator reaches its peak before given year
;
range of years between which a peak happens with the given probability pi
.
The indicator can be either population (if country
is given), or it can be any expression defined as a function of time (see pop.expressions
).
List with elements:
prob.peak.less.given.year |
Probability that the indicator reaches its peak before |
given.year |
The value of |
peak.quantiles |
The lower bound, the upper bound and the median of years defining a time interval in which a peak happens with the given probability |
.
all.prob.peak.by.time |
Data frame containing the probability of peak happening in each projected year, as well as the corresponding cummulative probability. Years in which no peak is projected are not included. |
Hana Sevcikova
pop.expressions
sim.dir <- file.path(find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir, write.to.cache=FALSE)
# probability that population of Netherlands peaks before 2040
# and between which years it will peak with probablity 80%
peak.probability(pred, "NL", year = 2040, pi = 80)
# check visually with
# pop.trajectories.plot(pred, "NL")
# the same for female of age 45-49
peak.probability(pred, "NL", year = 2040, pi = 80, sex = "female", age = 10)
# probability of a peak for the potential support ratio in Ecuador
peak.probability(pred, expression = "PEC[5:13]/PEC[14:27]")
# check visually that it already peaked
# pop.trajectories.plot(pred, expression = "PEC[5:13]/PEC[14:27]")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.