Skip to content

Commit

Permalink
fixed "user" mig.method
Browse files Browse the repository at this point in the history
  • Loading branch information
hanase committed May 22, 2024
1 parent 2969fbe commit db316d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bayesPop
Type: Package
Title: Probabilistic Population Projection
Version: 10.0-1.9010
Version: 10.0-1.9011
Date: 2024-05-21
Author: Hana Sevcikova, Adrian Raftery, Thomas Buettner
Maintainer: Hana Sevcikova <[email protected]>
Expand Down
6 changes: 4 additions & 2 deletions R/predict.pop.R
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,13 @@ load.inputs <- function(inputs, start.year, present.year, end.year, wpp.year, fi
'PASFR', 'PASFRpattern', 'MIGtype', 'MIGm', 'MIGf', 'HIVparams', 'GQm', 'GQf',
'e0Mpred', 'e0Fpred', 'TFRpred', 'migMpred', 'migFpred', 'migBpred', 'estim.years', 'proj.years', 'wpp.year',
'start.year', 'present.year', 'end.year', 'annual', 'fixed.mx', 'fixed.pasfr',
'lc.for.hiv', 'lc.for.all', 'mig.rate.code', 'mig.age.method', #'mig.age.gcc',
'lc.for.hiv', 'lc.for.all', 'mig.rate.code', 'mig.age.method',
'observed'))
assign(par, get(par), envir=inp)
inp$pop.matrix <- list(male=pop.ini.matrix[['M']], female=pop.ini.matrix[['F']])
inp$PASFRnorms <- compute.pasfr.global.norms(inp)
inp$average.annual <- inputs$average.annual
inp$mig.alt.age.schedule <- inputs$mig.alt.age.schedule
return(inp)
}

Expand Down Expand Up @@ -867,6 +868,7 @@ migration.totals2age <- function(df, ages = NULL, annual = FALSE, time.periods =
mig.totals.name <- if(annual) "mig1.totals" else "mig5.totals"
sex.code <- if(sex == "M") 1 else 2
locs.env <- new.env()
#browser()
if(method == "user")
load(alt.schedule.file, envir = locs.env)
else {
Expand Down Expand Up @@ -981,7 +983,7 @@ migration.totals2age <- function(df, ages = NULL, annual = FALSE, time.periods =
res2 <- dcast(migtmp, frm, value.var = "migrate", fun.aggregate = mean)
attr(res, "rate") <- res2
#if(debug) stop("")
migtmp[, rate_code := (!is_pos_neg) + 2*is_pos_neg]
migtmp[, rate_code := (!is_pos_neg) + 2*is_pos_neg] # TODO: this can yield different codes for male and female
rate.code <- dcast(migtmp, frm, value.var = "rate_code", fun.aggregate = mean)
attr(res, "code") <- rate.code
}
Expand Down

0 comments on commit db316d5

Please sign in to comment.