knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# knitr::opts_knit$get("root.dir")  # alternative to the previous line
# the default autosave location will depend on this being setup
options(warn=-1)

1. Fit a one country model

library(fpemlocal)
fit <- fit_fp_c(
  surveydata_filepath = "data-raw/manuscript_example_data/afghanistan_4_married_example.csv",
  division_numeric_code = 4,
  is_in_union = "Y",
  first_year = 1970,
  last_year = 2030
)

2. Calculate point estimates for indicators

population_data <- read.csv("data-raw/manuscript_example_data/afghanistan_4_married_popdata_example.csv")
results <- calc_fp_c(fit = fit,
                     population_data = population_data)

3. Plot estimates and survey data

plot_fp_c(
  fit,
  results,
  indicators = c(
    "contraceptive_use_modern"
  )
)


FPRgroup/FPEMcountry documentation built on April 24, 2023, 4:32 p.m.