Skip to content

Commit

Permalink
updated default dataverse
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Jul 13, 2021
1 parent cd3eb69 commit b45dc97
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 33 deletions.
28 changes: 14 additions & 14 deletions R/fn_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ get_dv_mdl_smrys <- function (mdls_lup, mdl_nms_chr = NULL)
#' @param ttu_dv_dss_tb Ttu dataverse datasets (a tibble), Default: NULL
#' @param mdl_predrs_in_ds_chr Model predictors in dataset (a character vector), Default: NULL
#' @param utility_type_chr Utility type (a character vector), Default: NULL
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'firstbounce'
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'TTU'
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @return Ttu dataverse datasets (a tibble)
Expand All @@ -54,8 +54,8 @@ get_dv_mdl_smrys <- function (mdls_lup, mdl_nms_chr = NULL)
#' @importFrom purrr map_lgl
#' @keywords internal
get_filtered_ttu_dss <- function (ttu_dv_dss_tb = NULL, mdl_predrs_in_ds_chr = NULL,
utility_type_chr = NULL, ttu_dv_nms_chr = "firstbounce",
server_1L_chr = "dataverse.harvard.edu", key_1L_chr = NULL)
utility_type_chr = NULL, ttu_dv_nms_chr = "TTU", server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL)
{
if (is.null(ttu_dv_dss_tb))
ttu_dv_dss_tb <- get_ttu_dv_dss(ttu_dv_nms_chr = ttu_dv_nms_chr,
Expand Down Expand Up @@ -202,7 +202,7 @@ get_mdl_smrys <- function (ingredients_ls, mdl_nms_chr = NULL)
#' @param ttu_dv_dss_tb Ttu dataverse datasets (a tibble), Default: NULL
#' @param mdl_predrs_in_ds_chr Model predictors in dataset (a character vector), Default: NULL
#' @param utility_type_chr Utility type (a character vector), Default: NULL
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'firstbounce'
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'TTU'
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @return Models (a lookup table)
Expand All @@ -213,8 +213,8 @@ get_mdl_smrys <- function (ingredients_ls, mdl_nms_chr = NULL)
#' @importFrom dplyr filter mutate
#' @keywords internal
get_mdls_lup <- function (ttu_dv_dss_tb = NULL, mdl_predrs_in_ds_chr = NULL,
utility_type_chr = NULL, ttu_dv_nms_chr = "firstbounce",
server_1L_chr = "dataverse.harvard.edu", key_1L_chr = NULL)
utility_type_chr = NULL, ttu_dv_nms_chr = "TTU", server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL)
{
if (is.null(ttu_dv_dss_tb))
ttu_dv_dss_tb <- get_ttu_dv_dss(ttu_dv_nms_chr = ttu_dv_nms_chr,
Expand All @@ -226,7 +226,7 @@ get_mdls_lup <- function (ttu_dv_dss_tb = NULL, mdl_predrs_in_ds_chr = NULL,
mdl_predrs_in_ds_chr = mdl_predrs_in_ds_chr, utility_type_chr = utility_type_chr)
}
if (!is.null(ttu_dv_dss_tb)) {
ds_smrys_ls <- get_ttu_ds_smrys("firstbounce", reference_int = ttu_dv_dss_tb$reference_int)
ds_smrys_ls <- get_ttu_ds_smrys("TTU", reference_int = ttu_dv_dss_tb$reference_int)
mdls_lup <- ds_smrys_ls %>% purrr::map2_dfr(names(ds_smrys_ls),
~{
predictors_lup <- .x$predictors_lup
Expand Down Expand Up @@ -339,7 +339,7 @@ get_tfmn_from_lup <- function (mdl_nm_1L_chr, mdls_lup = NULL)
}
#' Get ttu dataset summarys
#' @description get_ttu_ds_smrys() 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 ttu dataset summarys. Function argument ttu_dv_nm_1L_chr specifies the where to look for the required object. The function returns Dataverse datasets model summarys (a list).
#' @param ttu_dv_nm_1L_chr Ttu dataverse name (a character vector of length one), Default: 'firstbounce'
#' @param ttu_dv_nm_1L_chr Ttu dataverse name (a character vector of length one), Default: 'TTU'
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @param reference_int Reference (an integer vector), Default: NULL
Expand All @@ -350,7 +350,7 @@ get_tfmn_from_lup <- function (mdl_nm_1L_chr, mdls_lup = NULL)
#' @importFrom purrr map_chr compact map pluck
#' @importFrom stats setNames
#' @keywords internal
get_ttu_ds_smrys <- function (ttu_dv_nm_1L_chr = "firstbounce", server_1L_chr = "dataverse.harvard.edu",
get_ttu_ds_smrys <- function (ttu_dv_nm_1L_chr = "TTU", server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL, reference_int = NULL)
{
ds_ls <- dataverse::dataverse_contents(ttu_dv_nm_1L_chr,
Expand All @@ -367,7 +367,7 @@ get_ttu_ds_smrys <- function (ttu_dv_nm_1L_chr = "firstbounce", server_1L_chr =
}
#' Get ttu dataverse datasets
#' @description get_ttu_dv_dss() 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 ttu dataverse datasets. Function argument ttu_dv_nms_chr specifies the where to look for the required object. The function returns Ttu dataverse datasets (a tibble).
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'firstbounce'
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'TTU'
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @return Ttu dataverse datasets (a tibble)
Expand All @@ -380,7 +380,7 @@ get_ttu_ds_smrys <- function (ttu_dv_nm_1L_chr = "firstbounce", server_1L_chr =
#' @importFrom dplyr pull
#' @importFrom ready4use add_labels_from_dictionary
#' @keywords internal
get_ttu_dv_dss <- function (ttu_dv_nms_chr = "firstbounce", server_1L_chr = "dataverse.harvard.edu",
get_ttu_dv_dss <- function (ttu_dv_nms_chr = "TTU", server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL)
{
dv_dss_mdl_smrys_ls <- ttu_dv_nms_chr %>% purrr::map(~get_ttu_ds_smrys(.x,
Expand Down Expand Up @@ -410,16 +410,16 @@ get_ttu_dv_dss <- function (ttu_dv_nms_chr = "firstbounce", server_1L_chr = "dat
#' Get ttu dataverse predictors
#' @description get_ttu_dv_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 ttu dataverse predictors. Function argument ttu_dv_dss_tb specifies the where to look for the required object. The function returns Predictors (a character vector).
#' @param ttu_dv_dss_tb Ttu dataverse datasets (a tibble), Default: NULL
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'firstbounce'
#' @param ttu_dv_nms_chr Ttu dataverse names (a character vector), Default: 'TTU'
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @return Predictors (a character vector)
#' @rdname get_ttu_dv_predrs
#' @export
#' @importFrom purrr flatten_chr
#' @keywords internal
get_ttu_dv_predrs <- function (ttu_dv_dss_tb = NULL, ttu_dv_nms_chr = "firstbounce",
server_1L_chr = "dataverse.harvard.edu", key_1L_chr = NULL)
get_ttu_dv_predrs <- function (ttu_dv_dss_tb = NULL, ttu_dv_nms_chr = "TTU", server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL)
{
if (is.null(ttu_dv_dss_tb))
ttu_dv_dss_tb <- get_ttu_dv_dss(ttu_dv_nms_chr = ttu_dv_nms_chr,
Expand Down
12 changes: 6 additions & 6 deletions data-raw/fns/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ get_dv_mdl_smrys <- function(mdls_lup,
get_filtered_ttu_dss <- function(ttu_dv_dss_tb = NULL,
mdl_predrs_in_ds_chr = NULL,
utility_type_chr = NULL,
ttu_dv_nms_chr = "firstbounce",
ttu_dv_nms_chr = "TTU",
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL){
if(is.null(ttu_dv_dss_tb))
Expand Down Expand Up @@ -99,7 +99,7 @@ get_mdl_from_dv <- function(mdl_nm_1L_chr,
get_mdls_lup <- function(ttu_dv_dss_tb = NULL,
mdl_predrs_in_ds_chr = NULL,
utility_type_chr = NULL,
ttu_dv_nms_chr = "firstbounce",
ttu_dv_nms_chr = "TTU",
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL){
if(is.null(ttu_dv_dss_tb))
Expand All @@ -114,7 +114,7 @@ get_mdls_lup <- function(ttu_dv_dss_tb = NULL,
utility_type_chr = utility_type_chr)
}
if(!is.null(ttu_dv_dss_tb)){
ds_smrys_ls <- get_ttu_ds_smrys("firstbounce", reference_int = ttu_dv_dss_tb$reference_int)
ds_smrys_ls <- get_ttu_ds_smrys("TTU", reference_int = ttu_dv_dss_tb$reference_int)
mdls_lup <- ds_smrys_ls %>%
purrr::map2_dfr(names(ds_smrys_ls),
~{
Expand Down Expand Up @@ -231,7 +231,7 @@ get_predictors_lup <- function(mdl_meta_data_ls = NULL,
return(predictors_tb)
}
get_ttu_dv_predrs <- function(ttu_dv_dss_tb = NULL,
ttu_dv_nms_chr = "firstbounce",
ttu_dv_nms_chr = "TTU",
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL){
if(is.null(ttu_dv_dss_tb))
Expand All @@ -254,7 +254,7 @@ get_tfmn_from_lup <- function(mdl_nm_1L_chr, mdls_lup = NULL){

return(tfmn_1L_chr)
}
get_ttu_ds_smrys <- function(ttu_dv_nm_1L_chr = "firstbounce",
get_ttu_ds_smrys <- function(ttu_dv_nm_1L_chr = "TTU",
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL,
reference_int = NULL){
Expand All @@ -276,7 +276,7 @@ get_ttu_ds_smrys <- function(ttu_dv_nm_1L_chr = "firstbounce",
stats::setNames(names(dv_dss_mdl_smrys_ls)[reference_int])
return(dv_dss_mdl_smrys_ls)
}
get_ttu_dv_dss <- function(ttu_dv_nms_chr = "firstbounce",
get_ttu_dv_dss <- function(ttu_dv_nms_chr = "TTU",
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL){
dv_dss_mdl_smrys_ls <- ttu_dv_nms_chr %>%
Expand Down
4 changes: 2 additions & 2 deletions man/get_filtered_ttu_dss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_mdls_lup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_ttu_ds_smrys.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_ttu_dv_dss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_ttu_dv_predrs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion vignettes/Economic_Analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ predn_ds_ls <- make_predn_metadata_ls(ds_tb,
mdls_lup = get_mdls_lup(utility_type_chr = "AQoL-6D",
mdl_predrs_in_ds_chr = c("PHQ9 total score",
"SOFAS total score"),
ttu_dv_nms_chr = "firstbounce"),
ttu_dv_nms_chr = "TTU"),
mdl_nm_1L_chr = "PHQ9_SOFAS_1_OLS_CLL")
```

Expand Down Expand Up @@ -134,6 +134,7 @@ he_smry_ls <- ds_tb %>% make_hlth_ec_smry(predn_ds_ls = predn_ds_ls,
As part of the output of the `make_hlth_ec_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 =",")`, `r ifelse(he_smry_ls$ce_res_ls$ceac[he_smry_ls$ce_res_ls$k==50000]==0.5,"half",ifelse(he_smry_ls$ce_res_ls$ceac[he_smry_ls$ce_res_ls$k==50000]<0.5,"less than half","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, the 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}
library(ggplot2)
BCEA::ceplane.plot(he_smry_ls$ce_res_ls, wtp =50000,
area_color = "green",
graph = "ggplot2",
Expand Down
4 changes: 2 additions & 2 deletions vignettes/Prediction_With_Mdls.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ params:
library(magrittr)
library(youthu)
```
Note, all models and input data used in this example are fake data for illustrative purposes only - they should not be used to inform decision making.
Note, this example uses fake data - it should should not be used to inform decision making.

## Identifying suitable transfer to utility algorithms
To identify datasets that contain transfer to utility models compatible with youthu (ie those developped with the [TTU package](https://ready4-dev.github.io/TTU/index.html)), you can use the following command.

```{r}
ttu_dv_dss_tb <- get_ttu_dv_dss("firstbounce")
ttu_dv_dss_tb <- get_ttu_dv_dss("TTU")
```

```{r ttudss, echo = F, tab.cap='Transfer to Utility Datasets', tab.id = 'ttudss', results="asis"}
Expand Down

0 comments on commit b45dc97

Please sign in to comment.