Skip to content

Commit

Permalink
bug fix in e0.joint.plot
Browse files Browse the repository at this point in the history
  • Loading branch information
hanase committed Dec 23, 2023
1 parent b47f5d7 commit ee100a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
5.2-0.9xxx (09/27/2023)
5.2-0.9xxx (12/22/2023)
-----
Default for par.names and par.names.cs in e0.raftery.diag changed to all parameters.

Fixed bug in e0.joint.plot for annual prediction object.

5.2-0 (09/15/2023)
-----
Annual subnational projections are now possible, via the argument "annual"
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: bayesLife
Type: Package
Title: Bayesian Projection of Life Expectancy
Version: 5.2-0.9001
Date: 2023-09-27
Version: 5.2-0.9002
Date: 2023-12-22
Author: Hana Sevcikova, Adrian Raftery, Jennifer Chunn
Maintainer: Hana Sevcikova <[email protected]>
Description: Making probabilistic projections of life expectancy for all countries of the world, using a Bayesian hierarchical model <doi:10.1007/s13524-012-0193-x>. Subnational projections are also supported.
Expand Down
9 changes: 7 additions & 2 deletions R/plot_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ e0.joint.plot <- function(e0.pred, country, pi=95, years, nr.points=500,
if(!has.e0.jmale.prediction(e0.pred))
stop('A male prediction does not exist for the given prediction object. Run e0.jmale.predict.')
start.year <- as.integer(dimnames(e0.pred$quantiles)[[3]][1])
years.obs <- years[years <= start.year+2]
years.pred <- years[years > start.year+2]
if(e0.pred$mcmc.set$meta$annual.simulation){
years.obs <- years[years <= start.year]
years.pred <- years[years > start.year]
} else {
years.obs <- years[years <= start.year+2]
years.pred <- years[years > start.year+2]
}
years.idx <- unlist(lapply(years.pred, bayesTFR:::get.prediction.year.index, pred=e0.pred))
years.idx <- years.idx[years.idx > 1]
years.obs.idx <- unlist(lapply(years.obs, bayesTFR:::get.estimation.year.index, meta=e0.pred$mcmc.set$meta))
Expand Down

0 comments on commit ee100a8

Please sign in to comment.