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]")
Run the code above in your browser using DataLab