library(youthvars)
To derive a health utility score from the raw responses to a multi-attribute utility instrument it is necessary to implement a scoring algorithm. Scoring algorithms for the Assessment of Quality of Life Six Dimension (AQoL-6D) are publicly available in SPSS format. However, to include scoring algorithms in reproducible research workflows, it is desirable to have these algorithms available in open science languages such as R. We therefore developed R versions of the adult and adolescent versions of the AQoL-6D scoring algorithm and have made them available as part of the youthvars package.
To calculate AQoL 6D adolescent utility scores, a dataset with all twenty AQoL-6D questionnaire response items must be passed to the add_adol6d_scores
{.R} function. In the following illustrative example, we use the replication dataset that is included in the youthvars package.
data("replication_popl_tb", package = "youthvars")
The names of the twenty questionnaire response variables must all have a common prefix and end with the item number. In our replication dataset, they are named "aqol6d_q1", "aqol6d_q2" ... "aqol6d_q20". Details of the common prefix for the AQoL-6D response item variables, the name of the unique individual identifier variable and the desired name for the AQoL-6D adolescent utility score variable to be calculated must also be passed to the add_adol6d_scores
{.R} function. The function returns an updated dataset, with additional variables that include the intermediate and final calculations for AQoL 6D adolescent utility scores.
scored_data_tb <- add_adol6d_scores(replication_popl_tb, prefix_1L_chr = "aqol6d_q", id_var_nm_1L_chr = "fkClientID", wtd_aqol_var_nm_1L_chr = "aqol6d_total_w")
Before displaying the updated dataset, it may be desirable to label variables so that their meaning is clearer. The first step to do this is to create a data dictionary that extends to all variables in the updated dataset, by combining a data dictionary for the source (unscored) dataset (in our case repln_ds_dict_r3
{.R}) with a data dictionary for a template scored dataset (aqol_scrg_dict_r3
{.R} for this example).
data("repln_ds_dict_r3", package = "youthvars") data("aqol_scrg_dict_r3", package = "youthvars") dictionary_tb <- ready4::renew(repln_ds_dict_r3, new_cases_r3 = aqol_scrg_dict_r3)
Labels from the new data dictionary can then be added to our updated (scored) dataset.
scored_data_tb <- scored_data_tb %>% ready4use::add_labels_from_dictionary(dictionary_tb)
The following lines then print the first six lines of the updated dataset as a table, using variable labels as column names.
scored_data_tb %>% head() %>% ready4show::print_table(output_type_1L_chr = ifelse(knitr::is_html_output(),"HTML","PDF"), use_rdocx_1L_lgl = F, caption_1L_chr = "Replication dataset with AQoL scores", use_lbls_as_col_nms_1L_lgl = T, mkdn_tbl_ref_1L_chr = "tab:scoredds")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.