Skip to content

Commit

Permalink
fix in time index for imputation
Browse files Browse the repository at this point in the history
  • Loading branch information
hanase committed Feb 2, 2024
1 parent ee100a8 commit 10afd15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Default for par.names and par.names.cs in e0.raftery.diag changed to all paramet

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

Fixed bug in setting time index when imputation is present in e0.predict.subnat().

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.9002
Date: 2023-12-22
Version: 5.2-0.9003
Date: 2024-02-02
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
4 changes: 2 additions & 2 deletions R/project_subnat.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ e0.predict.subnat <- function(countries, my.e0.file, sim.dir=file.path(getwd(),
PIs_cqp <- array(NA, c(nr.reg, length(quantiles.to.keep), nrow(wtrajs)),
dimnames=list(meta$regions$country_code, dimnames(wpred$quantiles)[[2]], dimnames(wtrajs)[[1]]))
mean_sd <- array(NA, c(nr.reg, 2, nrow(wtrajs)))
#meta$Tc.index <- .get.Tcindex(meta$e0.matrix, cnames = meta$regions$country_name)
meta$Tc.index <- .get.Tcindex(meta$e0.matrix, cnames = meta$regions$country_name)
country.char <- as.character(country.obj$code)
e0reconstructed <- meta$e0.matrix

Expand All @@ -171,7 +171,7 @@ e0.predict.subnat <- function(countries, my.e0.file, sim.dir=file.path(getwd(),
widx <- which(rownames(wtrajs.all) %in% names(rege0[i]))
c.first <- rep(do.call(paste0("compute.alpha.", method), list(rege0[i], wtrajs.all[widx,])),
nr.traj) # set of initial scales
meta$Tc.index[region] <- i
meta$Tc.index[[region]] <- meta$Tc.index[[region]][meta$Tc.index[[region]] <= i]
imptraj <- matrix(NA, nrow = length(rege0) - i, ncol = nr.traj) # trajectory matrix for imputation
for(tr in 1:nr.traj) { # iterate over trajectories
imp.time <- i:(length(rege0)-1)
Expand Down

0 comments on commit 10afd15

Please sign in to comment.