From bfafdfcce542d4bbd87e4e695cc9330ebe0f1a99 Mon Sep 17 00:00:00 2001 From: Matthew Hamilton Date: Thu, 18 Feb 2021 23:17:11 +1100 Subject: [PATCH] Half finished econ analysis vignette --- .Rbuildignore | 1 + NAMESPACE | 1 + R/db_mdls_smry_tb.R | 14 -- R/fn_add.R | 22 ++- R/fn_extract.R | 1 + R/fn_get.R | 3 - R/fn_make.R | 3 - _pkgdown.yml | 9 +- data-raw/DATASET.R | 26 +--- data-raw/fns/add.R | 17 +++ data-raw/vignettes/_Clippings.Rmd | 69 +++++++++ data/fns_dmt_tb.rda | Bin 3528 -> 3561 bytes man/add_aqol6d_predn_to_ds.Rd | 1 - man/add_qalys_to_ds.Rd | 19 +++ man/extract_guide_box_lgd.Rd | 1 + man/fns_dmt_tb.Rd | 2 +- man/get_mdl_from_dv.Rd | 1 - man/get_mdls_using_predrs.Rd | 1 - man/get_tfmn_from_lup.Rd | 1 - man/make_he_smry.Rd | 1 - man/make_matched_ds.Rd | 1 - man/make_sngl_grp_ds.Rd | 1 - man/mdls_smry_tb.Rd | 27 ---- pkgdown/favicon/apple-touch-icon-120x120.png | Bin 3995 -> 3995 bytes pkgdown/favicon/apple-touch-icon-152x152.png | Bin 4597 -> 4597 bytes pkgdown/favicon/apple-touch-icon-180x180.png | Bin 5000 -> 5000 bytes pkgdown/favicon/apple-touch-icon-60x60.png | Bin 2380 -> 2380 bytes pkgdown/favicon/apple-touch-icon-76x76.png | Bin 2938 -> 2938 bytes pkgdown/favicon/apple-touch-icon.png | Bin 5000 -> 5000 bytes pkgdown/favicon/favicon-16x16.png | Bin 762 -> 762 bytes pkgdown/favicon/favicon-32x32.png | Bin 1174 -> 1174 bytes ...mic_Analysis.Rmd => Economic_Analysis.Rmd} | 137 +++++------------- vignettes/youthu.Rmd | 1 + 33 files changed, 184 insertions(+), 176 deletions(-) delete mode 100644 R/db_mdls_smry_tb.R create mode 100644 data-raw/vignettes/_Clippings.Rmd create mode 100644 man/add_qalys_to_ds.Rd delete mode 100644 man/mdls_smry_tb.Rd rename vignettes/{_Economic_Analysis.Rmd => Economic_Analysis.Rmd} (58%) diff --git a/.Rbuildignore b/.Rbuildignore index dbe1dd27..ebc3fb29 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -59,3 +59,4 @@ ^data-raw/vignettes/_AQoL_6D_Syn_Pop\.Rmd$ ^doc$ ^Meta$ +^data-raw/vignettes/_Clippings\.Rmd$ diff --git a/NAMESPACE b/NAMESPACE index aefb6982..5b3b23b2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,6 +8,7 @@ export(add_costs_from_gamma_dist) export(add_dates_from_dist) export(add_diffs_by_group_and_tmpt) export(add_qalys) +export(add_qalys_to_ds) export(extract_guide_box_lgd) export(firstbounce_aqol6d_adol) export(firstbounce_bads) diff --git a/R/db_mdls_smry_tb.R b/R/db_mdls_smry_tb.R deleted file mode 100644 index b762c799..00000000 --- a/R/db_mdls_smry_tb.R +++ /dev/null @@ -1,14 +0,0 @@ -#' Summary coefficients for youthu transfer to utility models -#' -#' A summary of the models included in the youthu package that can be used to predict adolescent AQoL6D. Note this summary is a placeholder as all models have been estimated from synthetic data. -#' -#' A tibble -#' -#' \describe{ -#' \item{Model}{NO MATCH} -#' \item{Parameter}{NO MATCH} -#' \item{Estimate}{NO MATCH} -#' \item{SE}{NO MATCH} -#' \item{CI_95}{NO MATCH} -#' } -"mdls_smry_tb" diff --git a/R/fn_add.R b/R/fn_add.R index 54bf2f2e..5feb7f14 100644 --- a/R/fn_add.R +++ b/R/fn_add.R @@ -20,7 +20,6 @@ #' @importFrom dplyr rename select left_join #' @importFrom rlang sym #' @importFrom tidyselect all_of -#' @keywords internal add_aqol6d_predn_to_ds <- function (data_tb, model_mdl, tfmn_1L_chr, predr_vars_nms_chr = NULL, utl_var_nm_1L_chr = NULL, id_var_nm_1L_chr = "fkClientID", round_var_nm_1L_chr = "round", round_bl_val_1L_chr = "Baseline", @@ -270,3 +269,24 @@ add_qalys <- function (ds_tb, cmprsn_var_nm_1L_chr = "study_arm_chr", duration_v } return(updated_ds_tb) } +#' Add qalys to dataset +#' @description add_qalys_to_ds() is an Add function that updates an object by adding data to that object. Specifically, this function implements an algorithm to add qalys to dataset. Function argument ds_tb specifies the object to be updated. The function returns Dataset (a tibble). +#' @param ds_tb Dataset (a tibble) +#' @param ds_smry_ls Dataset smry (a list) +#' @return Dataset (a tibble) +#' @rdname add_qalys_to_ds +#' @export +#' @importFrom purrr map reduce +add_qalys_to_ds <- function (ds_tb, ds_smry_ls) +{ + args_ls_ls <- purrr::map(c(ds_smry_ls$predr_var_nms, ds_smry_ls$utl_var_nm_1L_chr), + ~list(change_var_nm_1L_chr = paste0(.x, "_change_dbl"), + var_nm_1L_chr = .x)) + ds_tb <- purrr::reduce(1:length(args_ls_ls), .init = ds_tb, + ~add_change_in_ds_var(.x, var_nm_1L_chr = args_ls_ls[[.y]]$var_nm_1L_chr, + change_var_nm_1L_chr = args_ls_ls[[.y]]$change_var_nm_1L_chr)) %>% + add_qalys(utl_change_var_nm_1L_chr = paste0(ds_smry_ls$utl_var_nm_1L_chr, + "_change_dbl"), utl_var_nm_1L_chr = ds_smry_ls$utl_var_nm_1L_chr, + duration_var_nm_1L_chr = "duration_prd", qalys_var_nm_1L_chr = "qalys_dbl") + return(ds_tb) +} diff --git a/R/fn_extract.R b/R/fn_extract.R index 0ba27b95..3758098a 100644 --- a/R/fn_extract.R +++ b/R/fn_extract.R @@ -5,6 +5,7 @@ #' @rdname extract_guide_box_lgd #' @export #' @importFrom ggplot2 ggplot_gtable ggplot_build +#' @keywords internal extract_guide_box_lgd <- function (a.gplot) { tmp <- ggplot2::ggplot_gtable(ggplot2::ggplot_build(a.gplot)) diff --git a/R/fn_get.R b/R/fn_get.R index 4d8ca95c..125080a2 100644 --- a/R/fn_get.R +++ b/R/fn_get.R @@ -9,7 +9,6 @@ #' @export #' @importFrom dataverse dataset_files #' @importFrom purrr map_chr -#' @keywords internal get_mdl_from_dv <- function (mdl_nm_1L_chr, dv_ds_nm_1L_chr = "https://doi.org/10.7910/DVN/JC6PTV", server_1L_chr = "dataverse.harvard.edu", key_1L_chr = NULL) { @@ -37,7 +36,6 @@ get_mdl_from_dv <- function (mdl_nm_1L_chr, dv_ds_nm_1L_chr = "https://doi.org/1 #' @importFrom dplyr filter mutate across everything pull #' @importFrom stringr str_trim #' @importFrom tibble as_tibble -#' @keywords internal get_mdls_using_predrs <- function (mdl_predrs_in_ds_chr, mdls_lup = NULL) { if (is.null(mdls_lup)) @@ -69,7 +67,6 @@ get_mdls_using_predrs <- function (mdl_predrs_in_ds_chr, mdls_lup = NULL) #' @export #' @importFrom utils data #' @importFrom ready4fun get_from_lup_obj -#' @keywords internal get_tfmn_from_lup <- function (mdl_nm_1L_chr, mdls_lup = NULL) { if (is.null(mdls_lup)) diff --git a/R/fn_make.R b/R/fn_make.R index 4c90aa8f..00425d32 100644 --- a/R/fn_make.R +++ b/R/fn_make.R @@ -183,7 +183,6 @@ make_formula <- function (dep_var_nm_1L_chr, predictors_chr, environment_env = p #' @importFrom boot boot #' @importFrom purrr map_int #' @importFrom BCEA bcea -#' @keywords internal make_he_smry <- function (ds_tb, change_vars_chr = NA_character_, wtp_dbl = 50000, bootstrap_iters_1L_int = 1000, change_types_chr = "dbl", benefits_pfx_1L_chr = "qalys_dbl", benefits_var_nm_1L_chr = "qalys", @@ -221,7 +220,6 @@ make_he_smry <- function (ds_tb, change_vars_chr = NA_character_, wtp_dbl = 5000 #' @rdname make_matched_ds #' @export #' @importFrom dplyr mutate across -#' @keywords internal make_matched_ds <- function (sngl_grp_ds, cmprsn_smry_tb, ds_smry_ls) { matched_ds_tb <- sngl_grp_ds_tb %>% make_fake_trial_ds(id_var_nm_1L_chr = ds_smry_ls$id_var_nm_1L_chr, @@ -284,7 +282,6 @@ make_matched_ds_spine <- function (ds_tb, round_var_nm_1L_chr = "Timepoint_chr", #' @export #' @importFrom dplyr select mutate arrange #' @importFrom tibble as_tibble -#' @keywords internal make_sngl_grp_ds <- function (seed_ds_tb = NULL, ds_smry_ls) { sngl_grp_ds_tb <- seed_ds_tb %>% dplyr::select(ds_smry_ls$id_var_nm_1L_chr, diff --git a/_pkgdown.yml b/_pkgdown.yml index 30e8fb36..970d2e60 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -32,4 +32,11 @@ reference: - firstbounce_sofas - title: "Functions" - contents: - - extract_guide_box_lgd + - add_aqol6d_predn_to_ds + - add_qalys_to_ds + - get_mdl_from_dv + - get_mdls_using_predrs + - get_tfmn_from_lup + - make_he_smry + - make_matched_ds + - make_sngl_grp_ds diff --git a/data-raw/DATASET.R b/data-raw/DATASET.R index 9e3343b8..f610439b 100644 --- a/data-raw/DATASET.R +++ b/data-raw/DATASET.R @@ -103,27 +103,9 @@ utils::data("fn_type_lup_tb") fns_dmt_tb <- ready4fun::make_dmt_for_all_fns(paths_ls = ready4fun::make_fn_nms()[1], undocumented_fns_dir_chr = ready4fun::make_undmtd_fns_dir_chr()[1], custom_dmt_ls = list(details_ls = NULL, - inc_for_main_user_lgl_ls = list(force_true_chr = c("add_aqol6d_items_to_tbs_ls","add_aqol_scores_tbs_ls", - "add_aqol6dU_to_aqol6d_items_tb","add_aqol6dU_to_tbs_ls", - "add_cors_and_uts_to_tbs_ls_ls","add_dim_disv_to_aqol6d_items_tb", - "add_dim_scores_to_aqol6d_items_tb", "add_unwtd_dim_tots", - "add_itm_disv_to_aqol6d_itms_tb","add_labels_to_aqol6d_tb", - "add_uids_to_tbs_ls","calculate_aqol6d_dim_1_disv", - "calculate_aqol6d_dim_2_disv","calculate_aqol6d_dim_3_disv", - "calculate_aqol6d_dim_4_disv","calculate_aqol6d_dim_5_disv", - "calculate_aqol6d_dim_6_disv","calculate_adult_aqol6dU", - "extract_guide_box_lgd","force_min_max_and_int_cnstrs", - "force_vec_to_sum_to_int","impute_adult_aqol6d_items_tb", - #"make_aqol_items_props_tbs_ls", - "make_aqol6d_fns_ls", - "make_aqol6d_items_tb", "make_correlated_data_tb", - "make_corstars_tbl_xx","make_dim_sclg_cons_dbl", - "make_domain_items_ls","make_item_wrst_wghts_ls_ls", - "make_pdef_cor_mat_mat", "make_synth_series_tbs_ls", - "make_vec_with_sum_of_int", "randomise_changes_in_fct_levs", - "reorder_tbs_for_target_cors","replace_with_missing_vals", - "scramble_xx","transform_raw_aqol_tb_to_aqol6d_tb", - "write_results_to_csv"), + inc_for_main_user_lgl_ls = list(force_true_chr = c("add_aqol6d_predn_to_ds","add_qalys_to_ds", + "get_mdl_from_dv","get_mdls_using_predrs","get_tfmn_from_lup", + "make_he_smry","make_sngl_grp_ds","make_matched_ds"), force_false_chr = NA_character_), args_ls_ls = NULL), fn_type_lup_tb = fn_type_lup_tb, @@ -191,7 +173,7 @@ readLines(".github/workflows/R-CMD-check.yaml")[-28] %>% writeLines(".github/workflows/R-CMD-check.yaml") ready4fun::write_and_doc_fn_fls(fns_dmt_tb, r_dir_1L_chr = "R", - dev_pkgs_chr = c("ready4fun","ready4show","ready4use","TTU"), + dev_pkgs_chr = c("ready4fun","ready4show","ready4use","TTU","dataverse"), update_pkgdown_1L_lgl = T, path_to_dvpr_dmt_dir_1L_chr = "../../../../../Documentation/Code/Developer", path_to_user_dmt_dir_1L_chr = "../../../../../Documentation/Code/User") diff --git a/data-raw/fns/add.R b/data-raw/fns/add.R index 219aeb45..cf5bcf7f 100644 --- a/data-raw/fns/add.R +++ b/data-raw/fns/add.R @@ -194,3 +194,20 @@ add_qalys <- function(ds_tb, } return(updated_ds_tb) } +add_qalys_to_ds <- function(ds_tb, + ds_smry_ls){ + args_ls_ls <- purrr::map(c(ds_smry_ls$predr_var_nms, + ds_smry_ls$utl_var_nm_1L_chr), + ~ list(change_var_nm_1L_chr = paste0(.x,"_change_dbl"), + var_nm_1L_chr = .x)) + ds_tb <- purrr::reduce(1:length(args_ls_ls), + .init = ds_tb, + ~ add_change_in_ds_var(.x, + var_nm_1L_chr = args_ls_ls[[.y]]$var_nm_1L_chr, + change_var_nm_1L_chr = args_ls_ls[[.y]]$change_var_nm_1L_chr)) %>% + add_qalys(utl_change_var_nm_1L_chr = paste0(ds_smry_ls$utl_var_nm_1L_chr,"_change_dbl"), + utl_var_nm_1L_chr = ds_smry_ls$utl_var_nm_1L_chr, + duration_var_nm_1L_chr = "duration_prd", + qalys_var_nm_1L_chr = "qalys_dbl") + return(ds_tb) +} diff --git a/data-raw/vignettes/_Clippings.Rmd b/data-raw/vignettes/_Clippings.Rmd new file mode 100644 index 00000000..54fce5f7 --- /dev/null +++ b/data-raw/vignettes/_Clippings.Rmd @@ -0,0 +1,69 @@ +--- +title: "_Clipplings" +author: "Matthew Hamilton" +date: "18/02/2021" +output: html_document +--- + +## Matched groups details + + +## Single group details +The `r sngl_grp_ds_tb %>% dplyr::filter(round == "Baseline") %>% nrow()` baseline records are summarised below. +```{r} +(sngl_grp_ds_tb %>% dplyr::filter(round == "Baseline"))[4:7] %>% summary() +``` +The summary of `r sngl_grp_ds_tb %>% dplyr::filter(round == "Follow-up") %>% nrow()` follow-up records: +```{r} +(sngl_grp_ds_tb %>% dplyr::filter(round == "Follow-up"))[4:7] %>% summary() +``` +We add a cost variable with gamma distributed costs that have mean values of \$300 for a defined period up to baseline and \$1500 for the costs accrued between baseline and follow-up. +The resulting single group dataset contains `r nrow(sngl_grp_ds_tb)` records, with a snapshot provided below. + +```{r} +sngl_grp_ds_tb %>% head() +``` + +# Types of economic analysis facilitated by youthu +There are four types of economic analysis in youth mental health that youthu can help with: + +- Extending cost-consequence and cost-effectiveness economic evaluations to include cost-utility analyses that are easier for healthcare policy-makers to interpret; +- Extending efficacy trials with a modelled analysis exploring the plausibility of the potential cost-effectiveness of study interventions; +- Extending single group datasets (e.g. health service records, pilot studys) with a modelled analysis of the potential for hypothethised interventions being cost-effective; and +- Assessing the potential economic value of alternative intervention research proposals. +```{r} +# var_nms_chr <- paste0(c("costs_dbl","qalys_dbl", paste0(c("PHQ9","SOFAS","AQOL6D_HU"), "_change_dbl")),"_Follow-up") + +``` + +```{r} +# named_mat <- bootstraps_ls$t +# colnames(named_mat) <- names(bootstraps_ls$t0) +``` + +```{r} +evpi_ls <- BCEA::evppi(names(he_smry_ls$bootstraps_ls$t0)[c(1,3)], + input = he_smry_ls$named_mat, + he = he_smry_ls$ce_res_ls) +``` +```{r fig.width=6} +BCEA::plot.evppi(evpi_ls, graph = "ggplot2") +``` + +```{r fig.width=6} +BCEA::eib.plot(he_smry_ls$ce_res_ls) +``` + +```{r fig.width=6} +BCEA::evi.plot(he_smry_ls$ce_res_ls, + graph = "ggplot2") +``` + +```{r fig.width=6} +BCEA::ceac.plot(he_smry_ls$ce_res_ls, + graph = "ggplot2", + #title = "my title", + line_colors = "green", + theme = ggplot2::theme_dark()) + +``` diff --git a/data/fns_dmt_tb.rda b/data/fns_dmt_tb.rda index 3c26807ecab442a0d4f1b7085d80de8050d6dd36..35a85515a722cf0a852dc174201902fd4fc819f4 100644 GIT binary patch literal 3561 zcmVZh|L{Nn2#^Q>nhXK} z0$@M^;1a)i+1N9USs{CZp8x8AHW1c?k4@ zk&{3T01c5E8Vv`j>SW1@p{J;D000000000q00000000006%;}N1jscfkeR63Q)+mV zXr7^_gFw?qq%<@QGy_2O01Y0ce9|SJdbdZ3T`-Q0%tL!5m^fg%l|mp9Vsv7Z02W}o-lie`^Vxo*J&)mf9qJ|_ z{}+z0mzp`rER2!gQxnS~Ssf@p7n6>DOp8hP>6nN|g@m4ZBZWJ6?nLMO{3qR>is|69 zZ0GdvYU#s%T}v(7R@tFB=+>SIbZQ#)t`+noRPbGq<>J}0nU&E5F2p!gX=%Y}texwt zSeKr)j5}f{2#(VXYred6_O#0N|F2c|qYn%lJ8e+Zw6t>N@n+j~M;FVhtEM`kboFVK z;PyA`^Yg{|M3mI9rjulROhnnCoTnj{b;bu>;=W9F<~uz%;iPf7#pc&{ilFv5#fyVt z>4-X-Ry4M@P}0loW34H;XKX`_lNLGK^RWktp*_IoQSFf?ut2dS52sstv5OI;l30U% ziRqD1L)V1+@FA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HbmlaX#-b;O7;(qde77-$q$NRA6x^pK_jG4q@vH-TB4n2!aaXC^z6V>5k04=;}P3~ z4&M-S_`QQZeB6-IEQq9|lPf^Eb`Al6b)|t*%)t;iX5+Z(3N>yEsd!?hLG!a6A&HB| zH6urHxOt=^YY7*CNr_^~tVSj2utS7yJx`~*8>oNMtRtX|DCa0g{}*yaI8c!Li^0uJ CY=G1N diff --git a/man/add_aqol6d_predn_to_ds.Rd b/man/add_aqol6d_predn_to_ds.Rd index 418a57fe..0192b77c 100644 --- a/man/add_aqol6d_predn_to_ds.Rd +++ b/man/add_aqol6d_predn_to_ds.Rd @@ -44,4 +44,3 @@ Updated (a tibble) \description{ add_aqol6d_predn_to_ds() is an Add function that updates an object by adding data to that object. Specifically, this function implements an algorithm to add aqol6d predn to dataset. Function argument data_tb specifies the object to be updated. The function returns Updated (a tibble). } -\keyword{internal} diff --git a/man/add_qalys_to_ds.Rd b/man/add_qalys_to_ds.Rd new file mode 100644 index 00000000..4a92736e --- /dev/null +++ b/man/add_qalys_to_ds.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/fn_add.R +\name{add_qalys_to_ds} +\alias{add_qalys_to_ds} +\title{Add qalys to dataset} +\usage{ +add_qalys_to_ds(ds_tb, ds_smry_ls) +} +\arguments{ +\item{ds_tb}{Dataset (a tibble)} + +\item{ds_smry_ls}{Dataset smry (a list)} +} +\value{ +Dataset (a tibble) +} +\description{ +add_qalys_to_ds() is an Add function that updates an object by adding data to that object. Specifically, this function implements an algorithm to add qalys to dataset. Function argument ds_tb specifies the object to be updated. The function returns Dataset (a tibble). +} diff --git a/man/extract_guide_box_lgd.Rd b/man/extract_guide_box_lgd.Rd index 245f267b..49defcaf 100644 --- a/man/extract_guide_box_lgd.Rd +++ b/man/extract_guide_box_lgd.Rd @@ -15,3 +15,4 @@ NA () \description{ extract_guide_box_lgd() is an Extract function that extracts data from an object. Specifically, this function implements an algorithm to extract guide box lgd. The function is called for its side effects and does not return a value. } +\keyword{internal} diff --git a/man/fns_dmt_tb.Rd b/man/fns_dmt_tb.Rd index b6c28078..c1c28553 100644 --- a/man/fns_dmt_tb.Rd +++ b/man/fns_dmt_tb.Rd @@ -5,7 +5,7 @@ \alias{fns_dmt_tb} \title{youthu function documentation table} \format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 26 rows and 10 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 27 rows and 10 columns. } \source{ \url{https://ready4-dev.github.io/youthu/} diff --git a/man/get_mdl_from_dv.Rd b/man/get_mdl_from_dv.Rd index 2f6cfa05..eb8f1aa1 100644 --- a/man/get_mdl_from_dv.Rd +++ b/man/get_mdl_from_dv.Rd @@ -26,4 +26,3 @@ NA () \description{ get_mdl_from_dv() is a Get function that retrieves a pre-existing data object from memory, local file system or online repository. Specifically, this function implements an algorithm to get mdl from dataverse. Function argument mdl_nm_1L_chr specifies the where to look for the required object. The function is called for its side effects and does not return a value. } -\keyword{internal} diff --git a/man/get_mdls_using_predrs.Rd b/man/get_mdls_using_predrs.Rd index a3db96c1..e3a98492 100644 --- a/man/get_mdls_using_predrs.Rd +++ b/man/get_mdls_using_predrs.Rd @@ -17,4 +17,3 @@ Filtered mdls (a lookup table) \description{ get_mdls_using_predrs() is a Get function that retrieves a pre-existing data object from memory, local file system or online repository. Specifically, this function implements an algorithm to get mdls using predrs. Function argument mdl_predrs_in_ds_chr specifies the where to look for the required object. The function returns Filtered mdls (a lookup table). } -\keyword{internal} diff --git a/man/get_tfmn_from_lup.Rd b/man/get_tfmn_from_lup.Rd index a1a3a65a..605f93f9 100644 --- a/man/get_tfmn_from_lup.Rd +++ b/man/get_tfmn_from_lup.Rd @@ -17,4 +17,3 @@ Tfmn (a character vector of length one) \description{ get_tfmn_from_lup() is a Get function that retrieves a pre-existing data object from memory, local file system or online repository. Specifically, this function implements an algorithm to get tfmn from lookup table. Function argument mdl_nm_1L_chr specifies the where to look for the required object. The function returns Tfmn (a character vector of length one). } -\keyword{internal} diff --git a/man/make_he_smry.Rd b/man/make_he_smry.Rd index f3046112..2404c2ba 100644 --- a/man/make_he_smry.Rd +++ b/man/make_he_smry.Rd @@ -53,4 +53,3 @@ He smry (a list) \description{ make_he_smry() is a Make function that creates a new R object. Specifically, this function implements an algorithm to make he smry. The function returns He smry (a list). } -\keyword{internal} diff --git a/man/make_matched_ds.Rd b/man/make_matched_ds.Rd index 0797a186..99cdf127 100644 --- a/man/make_matched_ds.Rd +++ b/man/make_matched_ds.Rd @@ -19,4 +19,3 @@ Matched dataset (a tibble) \description{ make_matched_ds() is a Make function that creates a new R object. Specifically, this function implements an algorithm to make matched dataset. The function returns Matched dataset (a tibble). } -\keyword{internal} diff --git a/man/make_sngl_grp_ds.Rd b/man/make_sngl_grp_ds.Rd index 08e3e9e6..b69c1f2e 100644 --- a/man/make_sngl_grp_ds.Rd +++ b/man/make_sngl_grp_ds.Rd @@ -17,4 +17,3 @@ Sngl grp dataset (a tibble) \description{ make_sngl_grp_ds() is a Make function that creates a new R object. Specifically, this function implements an algorithm to make sngl grp dataset. The function returns Sngl grp dataset (a tibble). } -\keyword{internal} diff --git a/man/mdls_smry_tb.Rd b/man/mdls_smry_tb.Rd deleted file mode 100644 index 8ee19b66..00000000 --- a/man/mdls_smry_tb.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/db_mdls_smry_tb.R -\docType{data} -\name{mdls_smry_tb} -\alias{mdls_smry_tb} -\title{Summary coefficients for youthu transfer to utility models} -\format{ -An object of class \code{data.frame} with 168 rows and 5 columns. -} -\usage{ -mdls_smry_tb -} -\description{ -A summary of the models included in the youthu package that can be used to predict adolescent AQoL6D. Note this summary is a placeholder as all models have been estimated from synthetic data. -} -\details{ -A tibble - -\describe{ -\item{Model}{NO MATCH} -\item{Parameter}{NO MATCH} -\item{Estimate}{NO MATCH} -\item{SE}{NO MATCH} -\item{CI_95}{NO MATCH} -} -} -\keyword{datasets} diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png index 26522bb03b223ef1eb3f5f7c5159eaaedf67cb50..a257f6769c4e361415ddcea9cef99aa2d23c4c70 100644 GIT binary patch delta 64 zcmbO&KU;pn1a@9Nae3D3|2Iw#;uA77wlXxaGBVaSFtjo-*pYI>WAbl4c{JgZmI+@b I>+t6T0Ds&Qt^fc4 delta 64 zcmbO&KU;pn1a>xgi3?_I^EXZp;uA73vobccGBVLNFtjo-a9(yyZSrqEc{E|8-*vMl I>+t6T0B86T_5c6? diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png index a85021f4c810322aacbd4a1d5b994d3c380b1041..68f270c273af6e7646a0c44c15412278a48a3ae7 100644 GIT binary patch delta 64 zcmeyW{8f3v1a@9Nae3D3|2IxwBOqjGY-MO-Wn`>vU}$Avup{M$$K+5!c{JgZmI+@b Iw+ZG00I$~+e*gdg delta 64 zcmeyW{8f3v1a>xg$>oM-oExXF5fCykvobccGBVXRFtjo-czW^dq{*Rz@@T?SdP?;s Iw+ZG00G);t^Z)<= diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png index 0560b1c3d7e406ac1691a22b868c3a762c511c6f..67e65592463de6d3acdb16b223a875401f201157 100644 GIT binary patch delta 64 zcmeBB?@*sGft{C6qJP(^yp7ZCg@g=^tqe`9j7+o*46O_dY7aj&wLP7>+R>p=_MyA>ZhE@g!PcNRGH2H;)Jeu&7o>INZ HlEV1_V}cUk diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png index ad6def072ea02eb681c70da2256cac1db4ed4739..497adfc9ffce7544a5d828a6c50aa6399f8aaec2 100644 GIT binary patch delta 64 zcmX>jbVg{x1a@9N(U08QE^nO9%pqiGY-MO-Wn`#rU}$Avp#S@1;^Z|P@@T?w%L?yK IzRQsh0Gc5bj{pDw delta 64 zcmX>jbVg{x1a>xgG4np{85^fFa|jujSs5Ez85wCC7+M(^D3pDcnY@NW9!)q<+k3&} HyBzrdPTCR& diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png index 07bc40ce8ed3368c49e4c7e7b2999a9cb3c61a8e..eb082ad077ac94f650f927f92420bff3ed806864 100644 GIT binary patch delta 64 zcmew*_DgKS1a@9Nu?(i?nH#4YatRq4TN#>I85wCC7+M(^$O&KmGx-*mJeqL6U$(lgklnY delta 64 zcmew*_DgKS1a>xgafeQ6zKzojxr7YNtc(qarjDyHz HZti>lXLAxO diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png index 2fa73588c652c53730c052ec5f253053436400b4..3c1cf9d3652d566bb33fc20239b55c1c8b98382d 100644 GIT binary patch delta 64 zcmeBB?@*sGft{C6^2gp^KQ>Oc7ZNfwwlXxaGBVXRFtjo-xV`0V(c~9G@@T@VUWT5V IEGe810Ozh2FaQ7m delta 64 zcmeBB?@*sGft^iW%FZHv^Tz4+LP7>+R>p=_MrPUuhE@g!S1hmdPktdJk0!h{C4ci| HN#T3|Tj3I- diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png index 296bc384d3767662ab9291aa1d766076a857eb66..727790e2938e22fe28469d199b56bcb8389a359f 100644 GIT binary patch delta 65 zcmeyx`ipf#1tU8zpG?PfzVgZSj3U!B#$P1+RlV; IayL^x0G%fjCjbBd delta 65 zcmeyx`ipf#1tU9~yzGLQPXd$c8BYosm{}PcS{Yet8yH#{7$_Ake>ORaNgho&SVul; IayL^x0GcEc!TsD J*JO2;d;oPP5(xkR delta 66 zcmbQnIgN9JFB3bPyqsm|;#HeNm?kg^8JJla8(J9~Xd4(>85mSMKUzKc8?!u`Fqd4E J_+)jKd;nqs5o-Vd diff --git a/vignettes/_Economic_Analysis.Rmd b/vignettes/Economic_Analysis.Rmd similarity index 58% rename from vignettes/_Economic_Analysis.Rmd rename to vignettes/Economic_Analysis.Rmd index 71a75b00..d172fdf6 100644 --- a/vignettes/_Economic_Analysis.Rmd +++ b/vignettes/Economic_Analysis.Rmd @@ -22,7 +22,7 @@ set.seed(1234) The main motivation behind the youthu package is to extend the types of economic analysis that can be undertaken with both single group (e.g. pilot study, health service records) and matched groups (e.g. trial) datasets that do not include measures of health utility. ## Example datasets -To illustrate the input data requirements and the practical application of youthu functions, we adapt the youthu `replication_popl_tb` [replication dataset](Replication_DS.html) to create synthetic (fake) single group and matched group datasets. To do so, we first make a list object `ds_smry_ls` that summarises the desired features of these datasets, such as: +To illustrate the input data requirements and the practical application of youthu functions, we adapt a [replication dataset from the youthu's sister package TTU](https://ready4-dev.github.io/TTU/articles/Replication_DS.html) to create synthetic (fake) single group and matched group datasets. To do so, we first make a list object `ds_smry_ls` that summarises the desired features of these datasets, such as: - the names of the predictors for utility to be included in the dataset; - the name of variables for unique unit identifier, data collection round, data collection date, costs and health utility measure; @@ -48,11 +48,12 @@ ds_smry_ls <- list(bl_start_date_dtm = Sys.Date() - lubridate::days(300), utl_var_nm_1L_chr = "AQoL6D_HU") ``` -We pass both the `ds_smry_ls` summary list and `replication_popl_tb` replication dataset to the `make_sngl_grp_ds`{.R} function to create an example single group dataset. +We pass both the `ds_smry_ls` summary list and the `replication_popl_tb` replication dataset to the `make_sngl_grp_ds`{.R} function to create an example single group dataset. ```{r} -sngl_grp_ds_tb <- make_sngl_grp_ds(replication_popl_tb,ds_smry_ls = ds_smry_ls) +sngl_grp_ds_tb <- make_sngl_grp_ds(TTU::replication_popl_tb,ds_smry_ls = ds_smry_ls) ``` -We can split a subset of our single group dataset into two propensity score matched groups - one each for intervention and control - using the `make_matched_ds`{.R} function. We also use this function to build in our assumptions about group differences in changes in PHQ9, SOFAS and costs measured at follow-up. The below example assumes **population** (not sample) mean differences between Intervention and Control arms of -2 for PHQ9, +4 for SOFAS and +$300 for costs. + +We can split a subset of our single group dataset into two propensity score matched groups - one each for intervention and control - using the `make_matched_ds`{.R} function. We also use this function to build in our assumptions about group differences in changes in PHQ9, SOFAS and costs measured at follow-up. The below example assumes **population** (not sample) mean change differences between Intervention and Control arms of -2 for PHQ9, -2 for SOFAS and +$300 for costs. ```{r} matched_ds_tb <- make_matched_ds(sngl_grp_ds, @@ -60,7 +61,7 @@ matched_ds_tb <- make_matched_ds(sngl_grp_ds, fns_ls = list(rnorm,rnorm,rnorm), abs_mean_diff_dbl = c(3,2,300), diff_sd_dbl = c(2,2,200), - multiplier_dbl = c(-1,1,1), + multiplier_dbl = c(-1,-1,1), min_dbl = c(0,0,0), max_dbl = c(27,100,Inf), integer_lgl = c(T,T,F)), @@ -103,36 +104,31 @@ summary((matched_ds_tb %>% dplyr::filter(study_arm_chr == "Intervention" & round summary((matched_ds_tb %>% dplyr::filter(study_arm_chr == "Intervention" & round == "Follow-up"))[5:7]) ``` -However, frequently a new intervention proves to be both more effective and more costly, in which case the policy message of such studies is much less clear due to the following limitations of each evaluation type: +The results summarised above create some significant barriers to meaningfully interpreting economic evaluations that are based on cost-consequence or cost-effectiveness analysis: + +- A cost-effectiveness analysis in which change in PHQ-9 was the benefit measure would be difficult to interpret as the Intervention arm is both more effective and more costly, which begs the question is it worth paying the extra dollars for the improvement as measured on the PHQ-9 scale? It is likely that, unlike the Quality Adjusted Life Year (QALY) outcome measure, there is no commonly used value for money benchmark for improvements measured in PHQ-9. Similarly, if the potential funding for the intervention is from a budget that is allocated to non-depressive illnesses (e.g. physical health), a PHQ-9 based cost-effectiveness analysis is not readily comparable with economic evaluations of other interventions potentially competing for these scarce funds. -- In cost consequence analyses, the lack of any formal weighting for each of the included outcome measures makes it harder to interpret situations where an intervention has different directions of impact across different outcomes (e.g. greater improvements in functional outcomes than the comparator, but not as much clinical improvement as in the control arm). -- In cost effectiveness analyses, the (probable) lack of any consensus value for a decision-maker's willingness to pay for improvements in the selected benefit measure mean the ICER statistic is not especially informative (e.g. is it good or bad value for money if it is necessary to pay \$100 for each unit of improvement on a clinical scale; is that intervention a better use of a decision maker's budget than an intervention that costs \$100 for a one point improvement on a different clinical scale for a different patient population?). +- A cost consequence analyses that summarised the differences in costs with the differences in changes in PHQ-9 and SOFAS score would be difficult to interpret because while the intervention is more effective than control for improvements measured on PHQ-9 (where lower scores are better), the control group is superior if benefits are based on functioning improvements as measured by SOFAS scores (where higher scores are better). The lack of any formal weighting for how to trade off clinical symptoms and functioning means that interpretation of this analysis will be highly subjective and likely to change across potential decision makers. -These types of short-comings can be significantly addressed by undertaking cost-utility analyses as: +These types of short-comings can be significantly addressed by undertaking cost-utility analyses (CUAs) as: -- it uses a measure of benefit - quality adjusted life years (QALYs) - that captures multiple, weighted domains of health in a single index measure that can be applied across health conditions; +- they use a measure of benefit - the QALY - that captures multiple domains of health, weighted by time and population preferences in a single index measure that can be applied across health conditions; - there are published benchmark willingness to pay values for use by decision makers in many countries to make ICER statistics readily interpretable. +The rest of this article demonstrates how youthu functions can be used to undertake CUA based analyses on the type of data we have just profiled. + +## Using youthu in a cost-utility analysis workflow -# Prediction model +Our first step is to identify which youthu models we will use to predict adolescent AQoL-6D and apply these models to our data. This step was explained in more detail in [another vignette article](Prediction_With_Mdls.html), so will be dealt with briefly here. + +First we retrieve the model we wish to use. ```{r} candidate_mdls_tb <- get_mdls_using_predrs(predictors_lup$short_name_chr[c(5,7)]) model_mdl <- get_mdl_from_dv(candidate_mdls_tb$mdl_nms_chr[4]) ``` -# Types of economic analysis facilitated by youthu -There are four types of economic analysis in youth mental health that youthu can help with: - -- Extending cost-consequence and cost-effectiveness economic evaluations to include cost-utility analyses that are easier for healthcare policy-makers to interpret; -- Extending efficacy trials with a modelled analysis exploring the plausibility of the potential cost-effectiveness of study interventions; -- Extending single group datasets (e.g. health service records, pilot studys) with a modelled analysis of the potential for hypothethised interventions being cost-effective; and -- Assessing the potential economic value of alternative intervention research proposals. - -## Extending cost-consequence and cost-effectiveness economic evaluations - -This example illustrates how youthu can be used to undertake cost-utility analysis in an economic evaluation dataset that does not contain any measure of health utility. - +We then use that model to predict health utility from the measures in our dataset. ```{r} econ_cmprsn_ds_tb <- add_aqol6d_predn_to_ds(data_tb = matched_ds_tb, model_mdl = model_mdl, @@ -144,101 +140,48 @@ econ_cmprsn_ds_tb <- add_aqol6d_predn_to_ds(data_tb = matched_ds_tb, dplyr::select(fkClientID, round, study_arm_chr, date_psx, duration_prd, dplyr::everything()) ``` ```{r} -econ_cmprsn_ds_tb %>% head() +econ_cmprsn_ds_tb %>% head() %>% + ready4show::print_table(output_type_1L_chr = "HTML", + caption_1L_chr = "Updated dataset with predicted utility", + use_lbls_as_col_nms_1L_lgl = T) ``` +Next we combine the health utility data with the interval between measurement data to calculate QALYs and add them to the dataset. ```{r} -args_ls_ls <- purrr::map(c(c("PHQ9","SOFAS"), - ds_smry_ls$utl_var_nm_1L_chr), - ~ list(change_var_nm_1L_chr = paste0(.x,"_change_dbl"), - var_nm_1L_chr = .x)) -econ_cmprsn_ds_tb <- purrr::reduce(1:length(args_ls_ls), - .init = econ_cmprsn_ds_tb, - ~ add_change_in_ds_var(.x, - var_nm_1L_chr = args_ls_ls[[.y]]$var_nm_1L_chr, - change_var_nm_1L_chr = args_ls_ls[[.y]]$change_var_nm_1L_chr)) %>% - add_qalys(utl_change_var_nm_1L_chr = paste0(ds_smry_ls$utl_var_nm_1L_chr,"_change_dbl"), - utl_var_nm_1L_chr = ds_smry_ls$utl_var_nm_1L_chr, - duration_var_nm_1L_chr = "duration_prd", - qalys_var_nm_1L_chr = "qalys_dbl") +econ_cmprsn_ds_tb <- econ_cmprsn_ds_tb %>% add_qalys_to_ds(ds_smry_ls = ds_smry_ls) ``` ```{r} -econ_cmprsn_ds_tb %>% head() -``` -```{r} -# var_nms_chr <- paste0(c("costs_dbl","qalys_dbl", paste0(c("PHQ9","SOFAS","AQOL6D_HU"), "_change_dbl")),"_Follow-up") - +econ_cmprsn_ds_tb %>% head() %>% + ready4show::print_table(output_type_1L_chr = "HTML", + caption_1L_chr = "Updated dataset with QALYs", + use_lbls_as_col_nms_1L_lgl = T) ``` +Now we can run the main economic analysis. This is implemented by the `make_he_smry`{.R} function, which first bootstraps the dataset (implemented by the `boot` function from the `boot` package) before passing the mean values for costs and qalys from each bootstrap sample to with `bcea` function of the `BCEA` package to calculate a range of health economic statistics. For this example we pass a value of 50,000 for the willingness to pay parameter, as this is the dollar amount commonly used in Australia as a benchmark for the value of a QALY. + +Note, for this illustrative example we only request 100 bootstrap iterations - in practice this number would be much higher. ```{r} -he_smry_ls <- econ_cmprsn_ds_tb %>% make_he_smry(change_vars_chr = c("PHQ9","SOFAS","AQoL6D_HU"), +he_smry_ls <- econ_cmprsn_ds_tb %>% make_he_smry(change_vars_chr = c(ds_smry_ls$predr_var_nms, + ds_smry_ls$utl_var_nm_1L_chr), wtp_dbl = 50000, - bootstrap_iters_1L_int = 100, + bootstrap_iters_1L_int = 100L, change_types_chr = c("dbl","dbl","dbl"), benefits_pfx_1L_chr = "qalys_dbl", benefits_var_nm_1L_chr = "qalys", - costs_pfx_1L_chr = "costs_dbl", + costs_pfx_1L_chr = ds_smry_ls$costs_var_nm_1L_chr, costs_var_nm_1L_chr = "costs", change_sfx_1L_chr = "change", - cmprsn_groups_chr = c("Intervention","Control"), - cmprsn_var_nm_1L_chr = "study_arm_chr", - round_fup_1L_chr = "Follow-up") -``` - -```{r} -# named_mat <- bootstraps_ls$t -# colnames(named_mat) <- names(bootstraps_ls$t0) -``` - -```{r} -evpi_ls <- BCEA::evppi(names(he_smry_ls$bootstraps_ls$t0)[c(1,3)], - input = he_smry_ls$named_mat, - he = he_smry_ls$ce_res_ls) -``` -```{r fig.width=6} -BCEA::plot.evppi(evpi_ls, graph = "ggplot2") + cmprsn_groups_chr = ds_smry_ls$cmprsn_groups_chr, + cmprsn_var_nm_1L_chr = ds_smry_ls$cmprsn_var_nm_1L_chr, + round_fup_1L_chr = ds_smry_ls$round_lvls_chr[2]) ``` -```{r fig.width=6} -BCEA::eib.plot(he_smry_ls$ce_res_ls) -``` +As part of the output of the `make_he_smry`{.R} function is a BCEA object, we can use the BCEA package to produce a number of graphical summaries of economic results. One of the most important is the production of a cost-effectiveness plane. This plot highlights that, with an ICER of \$`r he_smry_ls$ce_res_ls$ICER %>% format(big.mark =",")`, most of the bootstrapped iteration incremental cost and QALY pairs fall within the zone of cost-effectiveness (green). In fact at the cost-effectiveness threshold we supplied, our results suggest there is a `r he_smry_ls$ce_res_ls$ceac[he_smry_ls$ce_res_ls$k==50000] * 100`% probability that the intervention is cost-effective. -```{r fig.width=6} -BCEA::evi.plot(he_smry_ls$ce_res_ls, - graph = "ggplot2") -``` - -```{r fig.width=6} -BCEA::ceac.plot(he_smry_ls$ce_res_ls, - graph = "ggplot2", - #title = "my title", - line_colors = "green", - theme = ggplot2::theme_dark()) - -``` ```{r fig.width=6} BCEA::ceplane.plot(he_smry_ls$ce_res_ls, wtp =50000, - # line = list(colors = "green"), area_color = "green", graph = "ggplot2", theme = ggplot2::theme_light()) ``` -## Matched groups details - - -## Single group details -The `r sngl_grp_ds_tb %>% dplyr::filter(round == "Baseline") %>% nrow()` baseline records are summarised below. -```{r} -(sngl_grp_ds_tb %>% dplyr::filter(round == "Baseline"))[4:7] %>% summary() -``` -The summary of `r sngl_grp_ds_tb %>% dplyr::filter(round == "Follow-up") %>% nrow()` follow-up records: -```{r} -(sngl_grp_ds_tb %>% dplyr::filter(round == "Follow-up"))[4:7] %>% summary() -``` -We add a cost variable with gamma distributed costs that have mean values of \$300 for a defined period up to baseline and \$1500 for the costs accrued between baseline and follow-up. -The resulting single group dataset contains `r nrow(sngl_grp_ds_tb)` records, with a snapshot provided below. - -```{r} -sngl_grp_ds_tb %>% head() -``` diff --git a/vignettes/youthu.Rmd b/vignettes/youthu.Rmd index 09f04b5a..72ce1472 100644 --- a/vignettes/youthu.Rmd +++ b/vignettes/youthu.Rmd @@ -23,3 +23,4 @@ The following vignettes demonstrate some of the tools currently included in the - [Data integrity tools](Data_Integrity.html) - [Predict Adolescent AQoL-6D](Prediction_With_Mdls.html) +- [Economic analysis](Economic_Analysis.html)