# NOT RUN {
## Using Bangladesh survey data to estimate child mortality
data("bangladesh")
bang_both <- u5mr_trussell(bangladesh, sex = "both", model = "south", svy_year = 1974.3)
bang_male <- u5mr_trussell(bangladesh, child_born = "male_born",
child_dead = "male_dead", sex = "male",
model = "south", svy_year = 1974.3)
bang_female <- u5mr_trussell(bangladesh, child_born = "female_born",
child_dead = "female_dead", sex = "female",
model = "south", svy_year = 1974.3)
## plotting all data points
with(bang_both,
plot(year, q5, type = "b", pch = 19,
ylim = c(0, .45),
col = "black", xlab = "Reference date", ylab = "u5MR",
main = paste0("Under-five mortality, q(5) in Bangladesh, estimated\n",
"using model South and the Trussell version of the Brass method")))
with(bang_both, text(year, q5, agegrp, cex=0.65, pos=3,col="purple"))
with(bang_male,
lines(year, q5, pch = 18, col = "red", type = "b", lty = 2))
with(bang_female,
lines(year, q5, pch = 18, col = "blue", type = "b", lty = 3))
legend("bottomright", legend=c("Both sexes", "Male", "Female"),
col = c("Black", "red", "blue"), lty = 1:3, cex=0.8)
## Using panama survey data to estimate child mortality
data("panama")
pnm_both <- u5mr_trussell(panama, sex = "both", model = "west", svy_year = 1976.5)
pnm_male <- u5mr_trussell(panama, child_born = "male_born",
child_dead = "male_dead", sex = "male",
model = "west", svy_year = 1976.5)
pnm_female <- u5mr_trussell(panama, child_born = "female_born",
child_dead = "female_dead", sex = "female",
model = "west", svy_year = 1976.5)
## plotting all data points
with(pnm_both,
plot(year, q5, type = "b", pch = 19,
ylim = c(0, .2), col = "black", xlab = "Reference date", ylab = "u5MR",
main = paste0("Under-five mortality, q(5) in Panama, estimated\n",
"using model West and the Trussell version of the Brass method")))
with(pnm_both, text(year, q5, agegrp, cex=0.65, pos=3,col="purple"))
with(pnm_male,
lines(year, q5, pch = 18, col = "red", type = "b", lty = 2))
with(pnm_female,
lines(year, q5, pch = 18, col = "blue", type = "b", lty = 3))
legend("bottomleft", legend=c("Both sexes", "Male", "Female"),
col = c("Black", "red", "blue"), lty = 1:3, cex=0.8)
# }
Run the code above in your browser using DataLab