knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## set global chunk options options(formatR.arrow=TRUE,width=80)
You can access this vignette from the R console by typing vignette("FPEMglobal_Age_1519", package = "FPEMglobal")
.
FPEMglobal (Family Planning Estimation Model global) implements a Bayesian hierarchical model for estimating and projecting the prevalence of contraceptive use and unmet need at the national level. This vignette concerns the application to adolescent women aged 15--19; for an introduction to the package see the vignette "FPEMglobal_Intro".
Default input data for adolescent women aged 15--19 can be accessed using the system.file()
command. For example:
## Find the file path in the package file tree data_csv_filename_1519 <- system.file("extdata", "data_cp_model_all_women_15-19.csv", #NOTE: '15-19' package = "FPEMglobal") ## Read in the file data_df_1519 <- read.csv(data_csv_filename_1519, header = TRUE, as.is = TRUE)
To implement estimation and projection for women aged 15--19 use the argument age_group = "15-19"
in the functions do_global_mcmc
, do_global_run
, or do_global_all_women_run
. The default, age_group = "15-49"
, will produce estimates and projections for all women of reproductive age.
Adjusted medians and special aggregates are handled in the same was as for the 15--49 age group via the arguments adjust_medians
(default = FALSE
) and special_aggregates_name
(default = NULL
), respectively.
## Do a global run for women aged 15-19, including summarization. ## Make sure you attach the package !! library(FPEMglobal) ## Call the main function all_women_runs_1519 <- do_global_all_women_run( ## Describe the run run_desc = "", age_group = "15-19", #....................................< SELECT '15-19' HERE data_csv_filename = "data_cp_model_all_women_15-19.csv", #< CHOOSE APPROPRIATE DATA ## MCMC parameters #......................................< CHANGE FOR FULL RUN! estimation_iterations = 2, burn_in_iterations = 1, steps_before_progress_report = 1, thinning = 1, chain_nums = 1:2, set_seed_chains = 1 ) ## See the run name !! ## All women, married women, and unmarried women output ## folders have the same date-time in their names. all_women_runs_1519
FPEMglobal can produce estimates and projections of the proportion of women of reproductive age using contraceptive methods, or experiencing unment need for contraception, that are aged 15--19. These are calculated as the ratio of in the respective family planning category aged 15--19 to the number in the category aged 15--49. The calculations are done at the trajectory level yielding true probabilistic estimates.
To compute age ratio indicators a completed model run for all women of reproductive age (i.e., age 15--49) must be available for each marital group desired. The output folder(s) of these runs are referred as age_total
directories. Age ratios can be requested in do_global_run
or do_global_all_women_run
when starting a new run, or in post_process
and combine_runs
when adding to an existing run. The arguments all begin with age_ratios_age_total_
. See the help files ?post_process_mcmc
and ?do_global_all_women_run
for an explanation in each case.
do_global_all_women_run
has an argument age_ratios_age_total_run_name_prefix
to make it easier to select the 15--49 outputs if they follow the standard naming convention for runs explained in the vignette "FPEMglobal_Intro". All that need be supplied in that case is the common output folder name prefix. E.g.,
do_global_all_women_run(..., age_ratios_age_total_run_name_prefix = "200501_093015")
will look for the married women 15-49 outputs in "r file.path("output", FPEMglobal:::make_run_name(marital_group = "married", age_group = "15-49", run_name_override = "200501_093015"))
"; unmarried and all women result output folder names will be constructed according to the same scheme.
## Do a global run for women aged 15-19, including summarization, with age ratios # Call the main function all_women_runs_1519 <- do_global_all_women_run( ## Describe the run run_desc = "", age_group = "15-19", #....................................< SELECT '15-19' HERE data_csv_filename = "data_cp_model_all_women_15-19.csv", #< CHOOSE APPROPRIATE DATA ## MCMC parameters #......................................< CHANGE FOR FULL RUN! estimation_iterations = 2, burn_in_iterations = 1, steps_before_progress_report = 1, thinning = 1, chain_nums = 1:2, set_seed_chains = 1, ## Age ratios age_ratios_age_total_run_name_prefix = "200501_093015" #..< COMMON PREFIX OF 15-49 OUTPUT FOLDERS )
The table below list the three methods by which the 15--49 results to be used for age ratio calculation can be selected, the functions they can be used with, and the corresponding function arguments.
+------------------------------+----------------------------------------+----------------------------------------------------------+
| Method | Function | Arguments |
+==============================+========================================+==========================================================+
| Common prefix | do_global_all_women_run
| age_ratios_age_total_run_name_prefix
|
+------------------------------+----------------------------------------+----------------------------------------------------------+
| Run name | do_global_run
| age_ratios_age_total_run_name
|
+------------------------------+----------------------------------------+----------------------------------------------------------+
| | do_global_all_women_run
| age_ratios_age_total_married_run_name
|
| | | age_ratios_age_total_unmarried_run_name
|
| | | age_ratios_age_total_all_women_run_name
|
+------------------------------+----------------------------------------+----------------------------------------------------------+
| Output folder path | do_global_run
| age_ratios_age_total_output_folder_path
|
+------------------------------+----------------------------------------+----------------------------------------------------------+
| | do_global_all_women_run
| age_ratios_age_total_married_output_folder_path
|
| | | age_ratios_age_total_unmarried_output_folder_path
|
| | | age_ratios_age_total_all_women_output_folder_path
|
+------------------------------+----------------------------------------+----------------------------------------------------------+
Base level control is available for adding results to, or reprocessing a completed model run. See the vignette "FPEMglobal_Intro" for details. The functions post_process_mcmc
, combine_runs
, and make_results
do not take the age_group
argument; this is read from the meta information saved by the do_...
functions.
In the following section, and an additional type of outputs is discussed: age ratios. The nature of this output is explained in that section. The table below gives a summary of the function call sequences needed to produce various combinations of outputs from a completed model run, including this two additional type. The completed run could have been obtained from any of the do_...
functions. In the example calls, default values of arguments are assumed and are not explicitly specified. It is further assumed that the appropriate run_name
s are passed as the first argument to all functions.
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| Marital Group | Output | Function call sequence |
+=======================+=================================================+=================================================================================+
| Married and unmarried | Age ratios, country level | post_process_mcmc(..., age_ratios_age_total_output_folder_path = "NAME")
\ |
| | | make_results
|
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Age ratios, std. aggregates | Age ratios, country level for both marital groups and all women completed \ |
| | | make_results
(must run again) |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Age ratios, spec. aggregates | Age ratios, country level for both marital groups and all women completed \ |
| | | make_results(..., special_aggregates_name = "[name]")
(must run again) |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, country level | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, std.aggregates | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, spec. aggregates | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| All women | Age ratios, country level | combine_runs(..., age_ratios_age_total_output_folder_path = "NAME")
\ |
| | | make_results
|
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Age ratios, std. aggregates | combine_runs(..., age_ratios_age_total_output_folder_path = "NAME")
\ |
| | | make_results
|
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Age ratios, spec. aggregates | combine_runs(..., age_ratios_age_total_output_folder_path = "NAME")
\ |
| | | make_results(..., special_aggregates_name = "[name]")
|
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, country level | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, std.aggregates | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
| | Adjusted median age ratios, spec. aggregates | Not available |
+-----------------------+-------------------------------------------------+---------------------------------------------------------------------------------+
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.