Installation
remotes::install_github("CAPTURE-TB-HIV/capturetb")Basic usage
To predict the unitcost of one outpatient visit given facility characteristics:
# Load model
model <- capturetb::unitcost()
# View covariates
covariates <- model$covariates()
print(covariates)
[1] "public" "urban" "healthcentre" "primary" "secondary"
[6] "tertiary" "logVisits"
# Generate predictions from posterior
inputs <- list(
logVisits = 6.9,
healthcentre = FALSE,
primary = TRUE,
secondary = FALSE,
tertiary = FALSE,
urban = FALSE,
public = TRUE,
output = "op_treatmentvisit",
fc_country = "Ethiopia"
)
prepared_inputs <- capturetb::prepare_covariates(inputs, model)
pred <- model$predict(
prepared_inputs,
scale = "natural",
summarised = TRUE)
# Expected unit cost is mean prediction
expected_unit_cost <- pred$Mean
print(expected_unit_cost)
[1] 17.72955Advanced usage
If fitting models, you will also need to install JAGS and the runjags package.
See vignettes for full documentation.
Testing
To run tests:
devtools::load_all()
devtools::test()To build pkgdown documentation locally:
devtools::load_all()
pkgdown::build_site()Files will appear in the docs/ folder.