├── .Rbuildignore
├── .circleci
└── config.yml
├── .gitignore
├── COPYING
├── DESCRIPTION
├── NAMESPACE
├── R
├── RcppExports.R
├── acceptability_curve.R
├── calibration.R
├── cluster.R
├── combine.R
├── compatability.R
├── complexity.r
├── correct_counts.R
├── covariance.R
├── define_transition.R
├── density.R
├── dispatch_strategy.R
├── efficiency_frontier.R
├── error_codes.R
├── evpi.R
├── evppi_define.R
├── evppi_eval.R
├── evppi_print.R
├── expand.R
├── formula.R
├── gho_mortality.R
├── heRomod.R
├── hero.R
├── hero_bc.R
├── hero_dsa.R
├── hero_scenario.R
├── hero_sensitivity_analysis.R
├── hero_threshold.R
├── hero_twsa.r
├── hero_vbp.r
├── hero_xlsx.R
├── look_up.R
├── matrix_define.R
├── matrix_eval.R
├── matrix_plot.R
├── matrix_sparse.R
├── newdata.R
├── parallelsugar.R
├── param_define.R
├── param_eval.R
├── param_print.R
├── part_surv.R
├── resamp_define.R
├── resamp_eval.R
├── resamp_print.R
├── run_model_define.R
├── run_model_summary.R
├── sensitivity_define.R
├── sensitivity_eval.R
├── sensitivity_print.R
├── states_define.R
├── states_eval.R
├── states_print.R
├── strategy_define.R
├── strategy_eval.R
├── strategy_print.R
├── sysdata.rda
├── tabular_input.R
├── theme_ggplot.R
├── transform.R
├── update.R
├── utils.R
├── vbp_define.R
├── vbp_eval.R
├── vbp_print.R
└── zzz.R
├── README.md
├── codecov.yml
├── data
├── data-raw
└── save_gho_mortality.R
├── inst
├── compat
│ ├── checkimab.json
│ ├── checkimab.rds
│ ├── custompsm.json
│ ├── custompsm.rds
│ ├── fit.json
│ ├── fit.rds
│ ├── groups.json
│ ├── groups.rds
│ ├── markov.json
│ ├── markov.rds
│ ├── psm.json
│ ├── psm.rds
│ ├── ta447.json
│ └── ta447.rds
├── examples
│ ├── example_calibration.R
│ ├── example_define_calibration_fn.R
│ ├── example_define_evppi.R
│ ├── example_define_parameters.R
│ ├── example_define_resample.R
│ ├── example_define_state.R
│ ├── example_define_strategy.R
│ ├── example_define_transition.R
│ ├── example_eval_parameters.R
│ ├── example_eval_strategy.R
│ ├── example_eval_strategy_newdata.R
│ ├── example_look_up.R
│ ├── example_plot.run_model.R
│ ├── example_run_dsa.R
│ ├── example_run_model.R
│ ├── example_run_psa.R
│ ├── example_run_vbp.R
│ ├── example_transform.R
│ └── example_update.R
├── hero
│ ├── advanced_surv_modeling
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ └── vbp_res.rds
│ ├── example_simple_psm
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ └── vbp_res.rds
│ ├── groups
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ ├── scen_res.rds
│ │ ├── scen_vbp_res.rds
│ │ ├── twsa_res.rds
│ │ └── vbp_res.rds
│ ├── markov_model
│ │ ├── .DS_Store
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ ├── scen_res.rds
│ │ ├── scen_vbp_res.rds
│ │ ├── twsa_res.rds
│ │ └── vbp_res.rds
│ ├── psm_responders
│ │ ├── .DS_Store
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ └── vbp_res.rds
│ ├── shared_st
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ ├── psa_res.rds
│ │ ├── scen_res.rds
│ │ └── vbp_res.rds
│ ├── sparse
│ │ ├── bc_res.rds
│ │ └── model.rds
│ ├── ta447
│ │ ├── bc_res.rds
│ │ ├── dsa_res.rds
│ │ ├── model.rds
│ │ └── vbp_res.rds
│ └── time-dependency
│ │ ├── bc_res.rds
│ │ └── model.rds
├── media
│ └── logo.png
└── tabular
│ ├── surv
│ ├── example_oncOptions.csv
│ ├── example_oncParams.csv
│ ├── example_oncParams_explicit_dists.csv
│ ├── example_oncParams_nomatrix.csv
│ ├── example_oncSpecs.csv
│ ├── example_oncSpecs_explicit_dists.csv
│ ├── example_oncSpecs_mixed.csv
│ ├── example_oncSpecs_nomatrix.csv
│ ├── example_oncSpecs_nomatrix_join.csv
│ ├── example_oncSpecs_nomatrix_run.csv
│ ├── example_oncSpecs_test_part_surv.csv
│ ├── example_oncStates.csv
│ ├── example_oncTransitionProbs.csv
│ ├── example_use_fits_explicit_dists.csv
│ ├── fake_fit_tib.csv
│ ├── set_definitions_1.csv
│ ├── set_definitions_2.csv
│ ├── set_definitions_error_1.csv
│ ├── surv_def_ok.csv
│ ├── surv_table.csv
│ ├── survival_data
│ │ ├── OS.A.surv.fits.RData
│ │ ├── OS.B.surv.fits.RData
│ │ ├── PFS.A.surv.fits.RData
│ │ ├── PFS.B.surv.fits.RData
│ │ ├── set_def_pfs_os.csv
│ │ ├── set_definitions.csv
│ │ ├── surv_data_OS.csv
│ │ ├── surv_data_OS_eventcode.csv
│ │ ├── surv_data_PFS.csv
│ │ └── surv_data_PFS_eventcode.csv
│ ├── survival_info.csv
│ ├── survival_info_eventcode.csv
│ ├── survival_info_eventcode_error.csv
│ ├── survival_info_explicit_dists.csv
│ ├── survival_info_nomatrix_run.csv
│ ├── use_fits.csv
│ ├── use_fits_example0.csv
│ ├── use_fits_join.csv
│ └── use_fits_mixed.csv
│ ├── test
│ ├── .gitignore
│ ├── REFERENCE_1probmissing.csv
│ ├── REFERENCE_missingfunctions.csv
│ ├── THR_options.csv
│ ├── THR_parameters.csv
│ ├── THR_test_states.csv
│ ├── THR_test_transition_probs.csv
│ ├── THR_test_transition_probs_1missing.csv
│ ├── THR_test_transition_probs_2.csv
│ ├── THR_test_transition_probs_bad.csv
│ ├── bad_REFERENCE.csv
│ ├── example_multinom_params.csv
│ ├── example_multinom_params_dup_name.csv
│ ├── survival_spec_1.csv
│ ├── survival_spec_2.csv
│ ├── survival_spec_error_1.csv
│ ├── survival_spec_error_2.csv
│ ├── test_diff_mod_name
│ │ ├── REFERENCE.csv
│ │ ├── THR_states.csv
│ │ └── THR_transition_probs.csv
│ ├── test_no_output_dir
│ │ ├── REFERENCE.csv
│ │ ├── THR_demographic_table.csv
│ │ ├── THR_options.csv
│ │ ├── THR_parameters.csv
│ │ ├── THR_states.csv
│ │ ├── THR_transition_probs.csv
│ │ └── input_dataframes
│ │ │ └── mr_table.xlsx
│ ├── test_no_overwrite
│ │ ├── REFERENCE.csv
│ │ ├── THR_demographic_table.csv
│ │ ├── THR_options.csv
│ │ ├── THR_parameters.csv
│ │ ├── THR_states.csv
│ │ ├── THR_transition_probs.csv
│ │ ├── input_dataframes
│ │ │ └── mr_table.xlsx
│ │ └── output
│ │ │ └── state_count_plot_standard.png
│ ├── testing_CSV_file_with_comment_col.csv
│ ├── testing_XLSX_file_with_comment_col.xlsx
│ ├── testing_XLS_file_with_comment_col.xls
│ ├── thr_trans
│ │ ├── .gitignore
│ │ ├── REFERENCE.csv
│ │ ├── REFERENCE_2core.csv
│ │ ├── THR_demographic_table.csv
│ │ ├── THR_options.csv
│ │ ├── THR_options_2core.csv
│ │ ├── THR_parameters.csv
│ │ ├── THR_state_trans.csv
│ │ ├── THR_states.csv
│ │ ├── THR_transition_probs.csv
│ │ └── input_dataframes
│ │ │ └── mr_table.xlsx
│ ├── toedit_REFERENCE.csv
│ └── wrong_ext.tab
│ └── thr
│ ├── .gitignore
│ ├── REFERENCE.csv
│ ├── REFERENCE_2core.csv
│ ├── THR_demographic_table.csv
│ ├── THR_options.csv
│ ├── THR_options_2core.csv
│ ├── THR_parameters.csv
│ ├── THR_states.csv
│ ├── THR_transition_probs.csv
│ └── input_dataframes
│ └── mr_table.xlsx
├── man
├── acceptability_curve.Rd
├── as_expr_list.Rd
├── by_group.Rd
├── by_group_hack.Rd
├── by_strategy.Rd
├── c_linear.Rd
├── calibrate_model.Rd
├── ce_strategy.Rd
├── check_matrix.Rd
├── check_names.Rd
├── check_states.Rd
├── check_strategy_index.Rd
├── clean_factors.Rd
├── cluster.Rd
├── combine_models.Rd
├── combine_probs.Rd
├── compute_counts.Rd
├── compute_evppi.Rd
├── compute_icer.Rd
├── compute_values.Rd
├── create_demographic_table.Rd
├── create_df_from_tabular.Rd
├── create_matrix_from_tabular.Rd
├── create_model_from_tabular.Rd
├── create_model_list_from_tabular.Rd
├── create_options_from_tabular.Rd
├── create_parameters_from_tabular.Rd
├── create_states_from_tabular.Rd
├── define_calibration_fn.Rd
├── define_correlation.Rd
├── define_dsa.Rd
├── define_evppi.Rd
├── define_inflow.Rd
├── define_init.Rd
├── define_parameters.Rd
├── define_part_surv.Rd
├── define_part_surv_custom.Rd
├── define_psa.Rd
├── define_starting_values.Rd
├── define_state.Rd
├── define_state_list.Rd
├── define_state_transition.Rd
├── define_state_transition_list.Rd
├── define_strategy.Rd
├── define_transition.Rd
├── define_vbp.Rd
├── discount.Rd
├── discount_hack.Rd
├── dispatch_strategy.Rd
├── dispatch_strategy_hack.Rd
├── distributions.Rd
├── eval_models_from_tabular.Rd
├── eval_parameters.Rd
├── eval_resample.Rd
├── eval_state_list.Rd
├── eval_strategy.Rd
├── eval_strategy_newdata.Rd
├── eval_transition.Rd
├── export_savi.Rd
├── file-checkers.Rd
├── filter_blanks.Rd
├── gather_model_info.Rd
├── get_counts.Rd
├── get_frontier.Rd
├── get_matrix_order.Rd
├── get_parameter_names.Rd
├── get_state_names.Rd
├── get_state_number.Rd
├── get_state_value_names.Rd
├── get_transition.Rd
├── get_values.Rd
├── heRomod.Rd
├── heRomod_scale.Rd
├── insert.Rd
├── interpolate.Rd
├── is.wholenumber.Rd
├── list_all_same.Rd
├── look_up.Rd
├── make_names.Rd
├── mclapply.Rd
├── mclapply_socket.Rd
├── modify.Rd
├── p_comp.Rd
├── param_in_strategy.Rd
├── parse_multi_spec.Rd
├── plot.dsa.Rd
├── plot.evppi_res.Rd
├── plot.psa.Rd
├── plot.run_model.Rd
├── plot.vbp.Rd
├── plur.Rd
├── probability.Rd
├── read_file.Rd
├── reexports.Rd
├── reindent_transition.Rd
├── rescale_discount_rate.Rd
├── resolve_dependencies.default.Rd
├── run_bcea.Rd
├── run_dsa.Rd
├── run_model.Rd
├── run_model_tabular.Rd
├── run_psa.Rd
├── run_vbp.Rd
├── safe_conversion.Rd
├── save_outputs.Rd
├── summary.run_model.Rd
├── summary.vbp.Rd
├── update_model.Rd
├── who_mortality.Rd
└── wtd_summary.Rd
├── src
├── .gitignore
├── RcppExports-ed4ceba3.o.tmp
├── RcppExports.cpp
├── code-3d31645c.o.tmp
└── code.cpp
├── tests
├── testthat.R
└── testthat
│ ├── .gitignore
│ ├── _snaps
│ ├── hero.md
│ └── threshold.md
│ ├── helper_compat.R
│ ├── helper_hero.R
│ ├── results.json
│ ├── test_calibration.R
│ ├── test_check_init.R
│ ├── test_code_preview.R
│ ├── test_compat.R
│ ├── test_dmhee.R
│ ├── test_efficiency_frontier.R
│ ├── test_evppi.R
│ ├── test_expand.R
│ ├── test_hero.R
│ ├── test_heterogeneity.R
│ ├── test_look_up.R
│ ├── test_matrix.R
│ ├── test_model.R
│ ├── test_parallel.R
│ ├── test_param_in_strategy.R
│ ├── test_parameters.R
│ ├── test_part_surv.R
│ ├── test_probabilistic.R
│ ├── test_run_model.R
│ ├── test_sensitivity.R
│ ├── test_states.R
│ ├── test_tabular_input.R
│ ├── test_threshold.R
│ ├── test_transform.R
│ ├── test_transition.R
│ ├── test_twsa.r
│ └── test_vbp.R
└── vignettes
├── .gitignore
├── a_introduction.R
├── a_introduction.Rmd
├── b_time_dependency.R
├── b_time_dependency.Rmd
├── c_homogeneous.R
├── c_homogeneous.Rmd
├── d_non_homogeneous.R
├── d_non_homogeneous.Rmd
├── e_probabilistic.R
├── e_probabilistic.Rmd
├── f_sensitivity.R
├── f_sensitivity.Rmd
├── g_heterogeneity.R
├── g_heterogeneity.Rmd
├── h_tabular.R
├── h_tabular.Rmd
├── i_reproduction.R
├── i_reproduction.Rmd
├── k_calibration.R
├── k_calibration.Rmd
├── l_value_based_pricing.R
├── l_value_based_pricing.Rmd
├── m_expected_value_partial_perfect_information.R
└── m_expected_value_partial_perfect_information.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^\.git
4 | ^\.travis\.yml$
5 | ^NEWS\.html$
6 | ^README\.html$
7 | ^vignettes/.*\.html$
8 | ^vignettes/.*\.md$
9 | ^codecov\.yml$
10 | ^data-raw$
11 | ^docs$
12 | ^_pkgdown\.yml$
13 | ^\.circleci$
14 | ^\.circleci/config\.yml$
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | *.Rproj
5 | README.html
6 | .Rproj
7 | heemod-expand.Rproj
8 | 04_progress
9 | *.RProj
10 | *.DS_Store
11 | results.json
12 | trying_state_time.xlsx
13 | *env.RData
14 | .Rapp.history
15 | .xlsx
16 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 |
2 | Original copyright 2015, 2016 Kevin Zarca, Antoine Filipovic-Pierucci.
3 | Modified copyright 2017 Jordan Amdahl.
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: heRomod
2 | Title: Health Economic Modeling
3 | Version: 0.0.1
4 | Encoding: UTF-8
5 | Authors@R: c(
6 | person("Jordan", "Amdahl", email = "jrdnmdhl@gmail.com", role = c("cre")),
7 | person("Antoine", "Filipovic-Pierucci", role = c("aut")),
8 | person("Kevin", "Zarca", role = "aut"),
9 | person("Matthew", "Wiener", role = "ctb"),
10 | person("Zdenek", "Kabat", role = "ctb"),
11 | person("Vojtech", "Filipec", role = "ctb"),
12 | person("Yonatan", "Carranza Alarcon", role=c("ctb")),
13 | person("Vince", "Daniels", role=c("ctb")),
14 | person("Fernando", "Alarid-Escudero", role=c("ctb"))
15 | )
16 | Description: A package for developing and running cost-effectiveness
17 | models in R. Forked from the HEEMOD package.
18 | Depends: R (>= 3.5.0),
19 | flexsurv,
20 | flexsurvcure,
21 | dplyr (>= 0.7.2),
22 | lazyeval (>= 0.2.0),
23 | tibble (>= 1.3.0),
24 | herosurv
25 | Imports:
26 | reshape2,
27 | ggplot2 (>= 2.2.0),
28 | memoise (>= 1.1.0),
29 | mvnfast (>= 0.2.2),
30 | plyr (>= 1.8.0),
31 | pryr (>= 0.1.2),
32 | matrixStats,
33 | msm,
34 | reshape2,
35 | tidyr,
36 | tools,
37 | utils,
38 | purrr,
39 | knitr,
40 | markdown,
41 | formula.tools,
42 | data.table,
43 | openxlsx,
44 | BCEA,
45 | diagram,
46 | knitr,
47 | logitnorm,
48 | lpSolve,
49 | mgcv,
50 | optimx,
51 | parallel,
52 | rmarkdown,
53 | stringr,
54 | survival,
55 | testthat,
56 | triangle,
57 | jsonlite,
58 | glue,
59 | Matrix,
60 | gtools,
61 | magrittr,
62 | rlang,
63 | Rcpp,
64 | rgho,
65 | xml2
66 | License: GPL (>= 3)
67 | LazyData: true
68 | VignetteBuilder: knitr
69 | RoxygenNote: 7.2.3
70 | URL: https://github.com/PolicyAnalysisInc/heRoMod
71 | BugReports: https://github.com/PolicyAnalysisInc/heRoMod/issues
72 | Roxygen: list(markdown = TRUE)
73 | Suggests:
74 | covr
75 | LinkingTo:
76 | Rcpp
77 |
--------------------------------------------------------------------------------
/R/RcppExports.R:
--------------------------------------------------------------------------------
1 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
2 | # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3 |
4 | cpp_convert_tables <- function(matrices, names) {
5 | .Call('_heRomod_cpp_convert_tables', PACKAGE = 'heRomod', matrices, names)
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/R/acceptability_curve.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2016 Antoine Pierucci
4 | #*
5 | #* This program is free software: you can redistribute it and/or modify
6 | #* it under the terms of the GNU General Public License as published by
7 | #* the Free Software Foundation, either version 3 of the License, or
8 | #* (at your option) any later version.
9 | #*
10 | #* This program is distributed in the hope that it will be useful,
11 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | #* GNU General Public License for more details.
14 | #*
15 | #* You should have received a copy of the GNU General Public License
16 | #* along with this program. If not, see .
17 | #**************************************************************************
18 |
19 | #' Acceptability Curve from Probabilistic Analysis
20 | #'
21 | #' @param x Result from [run_psa()].
22 | #' @param wtp_thresholds willingness to pay thresholds
23 | #'
24 | #' @return A data frame with columns `.ceac` (the
25 | #' cost-effectiveness acceptability threshold),
26 | #' `.model` (treatments or models), `.n` (the
27 | #' number of cases in which the treatment was most
28 | #' cost-effective), and `.p` (the proportion of cases
29 | #' where the treatment was most effective).
30 | #'
31 | #' @keywords internal
32 | #' @section Copyright: 2016 Antoine Pierucci
33 | acceptability_curve <- function(x, wtp_thresholds) {
34 | x %>%
35 | mutate(.key = 1) %>%
36 | left_join(
37 | tibble::tibble(
38 | .ceac = wtp_thresholds,
39 | .key = 1
40 | ),
41 | by = ".key"
42 | ) %>%
43 | group_by(.index, .ceac) %>%
44 | mutate(
45 | .nmb = .effect * .ceac - .cost,
46 | .top_strategy = .nmb == max(.nmb),
47 | .top_strategy = .top_strategy & cumsum(.top_strategy) == 1
48 | # in case 2 nmb are identical, pick first
49 | ) %>%
50 | group_by(.ceac, .strategy_names) %>%
51 | summarise(.n = sum(.top_strategy)) %>%
52 | group_by(.ceac) %>%
53 | mutate(.p = .n / sum(.n))
54 | }
55 |
56 | generate_wtp <- function(max_wtp,
57 | min_wtp = max_wtp / 1000,
58 | n, log_scale) {
59 | stopifnot(
60 | max_wtp > 0
61 | )
62 | if (log_scale) {
63 | res <- seq(from = log(min_wtp, base = 10),
64 | to = log(max_wtp, base = 10),
65 | length.out = n)
66 | 10 ^ res
67 | } else {
68 | seq(from = 0, to = max_wtp, length.out = n)
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/R/correct_counts.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2017 Antoine Pierucci
4 | #* Modified work Copyright (C) 2017 Jordan Amdahl
5 | #*
6 | #* This program is free software: you can redistribute it and/or modify
7 | #* it under the terms of the GNU General Public License as published by
8 | #* the Free Software Foundation, either version 3 of the License, or
9 | #* (at your option) any later version.
10 | #*
11 | #* This program is distributed in the hope that it will be useful,
12 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | #* GNU General Public License for more details.
15 | #*
16 | #* You should have received a copy of the GNU General Public License
17 | #* along with this program. If not, see .
18 | #**************************************************************************
19 |
20 |
21 | correct_counts <- function(x, method = c("life-table",
22 | "beginning",
23 | "end")) {
24 |
25 | if (! is.function(method)) {
26 | method <- match.arg(method)
27 |
28 | n0 <- x[- nrow(x), ]
29 | n1 <- x[-1, ]
30 |
31 | switch(
32 | method,
33 | "beginning" = {
34 | out <- n1
35 | },
36 | "end" = {
37 | out <- n0
38 | },
39 | "life-table" = {
40 | out <- (n0 + n1) / 2
41 | })
42 | } else {
43 | out <- method(x)
44 | }
45 |
46 | if (nrow(out) != nrow(x) - 1) {
47 | stop("State membership correction applied to an n-row table should return a table with n-1 rows.")
48 | }
49 |
50 | if(!is.null(attr(x, "entry"))) {
51 | attr(out, "entry") <- attr(x, "entry")
52 | }
53 |
54 | if(!is.null(attr(x, "exit"))) {
55 | attr(out, "exit") <- attr(x, "exit")
56 | }
57 |
58 | if(!is.null(attr(x, "transitions"))) {
59 | attr(out, "transitions") <- attr(x, "transitions")
60 | }
61 |
62 | class(out) <- class(x)
63 |
64 | return(out)
65 | }
66 |
--------------------------------------------------------------------------------
/R/define_transition.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2016 Antoine Pierucci
4 | #* Modified work Copyright (C) 2017 Jordan Amdahl
5 | #*
6 | #* This program is free software: you can redistribute it and/or modify
7 | #* it under the terms of the GNU General Public License as published by
8 | #* the Free Software Foundation, either version 3 of the License, or
9 | #* (at your option) any later version.
10 | #*
11 | #* This program is distributed in the hope that it will be useful,
12 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | #* GNU General Public License for more details.
15 | #*
16 | #* You should have received a copy of the GNU General Public License
17 | #* along with this program. If not, see .
18 | #**************************************************************************
19 |
20 |
21 | #' @export
22 | define_state_transition <- function(...) {
23 | if(is.na(from) && is.na(to)) stop("Either from or to must be defined.")
24 | .dots <- lazyeval::lazy_dots(...)
25 |
26 | define_state_transition_(.dots)
27 | }
28 |
29 | #' @export
30 | define_state_transition_ <- function(.dots) {
31 | check_names(names(.dots))
32 | structure(
33 | .dots,
34 | class = c("state_transition", class(.dots))
35 | )
36 | }
37 |
--------------------------------------------------------------------------------
/R/evppi_define.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2018 Fernando Alarid-Escudero
4 | #*
5 | #* This program is free software: you can redistribute it and/or modify
6 | #* it under the terms of the GNU General Public License as published by
7 | #* the Free Software Foundation, either version 3 of the License, or
8 | #* (at your option) any later version.
9 | #*
10 | #* This program is distributed in the hope that it will be useful,
11 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | #* GNU General Public License for more details.
14 | #*
15 | #* You should have received a copy of the GNU General Public License
16 | #* along with this program. If not, see .
17 | #**************************************************************************
18 |
19 |
20 | #' Define an Expected Value of Partial Perfect Information (EVPPI) Analysis
21 | #'
22 | #' Define the parameter for EVPPI analysis of Markov models using a
23 | #' linear regression metmodeling approach
24 | #'
25 | #' The parameter name should be a string
26 | #'
27 | #' @param par_names String of parameter name or names
28 | #'
29 | #' @return An `evppi` object.
30 | #' @export
31 | #'
32 | #' @references
33 | #' \enumerate{
34 | #' \item Jalal H, Alarid-Escudero F. A Gaussian Approximation Approach for Value of Information Analysis. Med Decis Making 2018; 38(2): 174-188.
35 | #' }
36 | #' @example inst/examples/example_define_evppi.R
37 | define_evppi <- function(...) {
38 |
39 | .dots <- lazyeval::lazy_dots(...)
40 |
41 | if (length(.dots) == 0) {
42 | stop("At least one parameter should be defined")
43 | }
44 |
45 | par_names <- character()
46 |
47 | for (i in seq_along(.dots)) {
48 | par_names <- c(par_names, deparse(.dots[[i]]$expr))
49 | }
50 |
51 | define_evppi_(par_names = par_names)
52 | }
53 |
54 | #' @rdname define_evppi
55 | define_evppi_ <- function(par_names) {
56 |
57 | check_names(par_names)
58 |
59 | if (any(duplicated(par_names))) {
60 | stop("Some names are duplicated.")
61 | }
62 |
63 | structure(
64 | list(
65 | variable = par_names
66 | ),
67 | class = "evppi_definition"
68 | )
69 | }
70 |
71 | #' @export
72 | print.evppi_definition <- function(x, ...) {
73 | print(paste0("An EVPPI definition for parameters: ",
74 | paste(x$variable, collapse = ", ")
75 | ))
76 | }
77 |
--------------------------------------------------------------------------------
/R/param_print.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2016 Antoine Pierucci
4 | #*
5 | #* This program is free software: you can redistribute it and/or modify
6 | #* it under the terms of the GNU General Public License as published by
7 | #* the Free Software Foundation, either version 3 of the License, or
8 | #* (at your option) any later version.
9 | #*
10 | #* This program is distributed in the hope that it will be useful,
11 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | #* GNU General Public License for more details.
14 | #*
15 | #* You should have received a copy of the GNU General Public License
16 | #* along with this program. If not, see .
17 | #**************************************************************************
18 |
19 |
20 | #' @export
21 | print.uneval_parameters <- function(x, ...) {
22 | cat(sprintf("%i unevaluated parameter%s.\n\n",
23 | length(x), plur(length(x))))
24 | res <- to_text_dots(x)
25 | cat(res, sep = "\n")
26 | }
27 |
--------------------------------------------------------------------------------
/R/states_print.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2016 Antoine Pierucci
4 | #* Modified work Copyright (C) 2016 Matt Wiener
5 | #* Modified work Copyright (C) 2017 Kevin Zarca
6 | #*
7 | #* This program is free software: you can redistribute it and/or modify
8 | #* it under the terms of the GNU General Public License as published by
9 | #* the Free Software Foundation, either version 3 of the License, or
10 | #* (at your option) any later version.
11 | #*
12 | #* This program is distributed in the hope that it will be useful,
13 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | #* GNU General Public License for more details.
16 | #*
17 | #* You should have received a copy of the GNU General Public License
18 | #* along with this program. If not, see .
19 | #**************************************************************************
20 |
21 | #' @export
22 | print.state <- function(x, ...) {
23 | cat(sprintf(
24 | "A state with %i value%s.\n\n",
25 | length(x), plur(length(x))))
26 |
27 | nv <- names(x)
28 | ex <- lapply(x, function(y) paste(deparse(y$expr), collapse = "\n"))
29 |
30 | cat(paste(nv, ex, sep = " = "), sep = "\n")
31 | }
32 |
33 | #' @export
34 | print.uneval_state_list <- function(x, ...) {
35 | n_state <- get_state_number(x)
36 | n_values <- length(get_state_value_names(x))
37 |
38 | cat(sprintf(
39 | "A list of %i state%s with %i value%s each.\n\n",
40 | n_state,
41 | plur(n_state),
42 | n_values,
43 | plur(n_values)
44 | ))
45 | cat("State names:\n\n")
46 | cat(get_state_names(x), sep = "\n")
47 |
48 | cat("\nState values:\n\n")
49 | cat(get_state_value_names(x), sep = "\n")
50 | }
51 |
52 | #' @export
53 | print.eval_state_list <- function(x, ...) {
54 | cat(sprintf(
55 | "%i evaluated state%s, %i Markov cycle%s.\n",
56 | length(x),
57 | plur(length(x)),
58 | nrow(x[[1]]),
59 | plur(nrow(x[[1]]))
60 | ))
61 | }
62 |
--------------------------------------------------------------------------------
/R/sysdata.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/R/sysdata.rda
--------------------------------------------------------------------------------
/R/zzz.R:
--------------------------------------------------------------------------------
1 | #**************************************************************************
2 | #*
3 | #* Original work Copyright (C) 2016 Antoine Pierucci
4 | #* Modified work Copyright (C) 2017 Matt Wiener
5 | #*
6 | #* This program is free software: you can redistribute it and/or modify
7 | #* it under the terms of the GNU General Public License as published by
8 | #* the Free Software Foundation, either version 3 of the License, or
9 | #* (at your option) any later version.
10 | #*
11 | #* This program is distributed in the hope that it will be useful,
12 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | #* GNU General Public License for more details.
15 | #*
16 | #* You should have received a copy of the GNU General Public License
17 | #* along with this program. If not, see .
18 | #**************************************************************************
19 |
20 |
21 | .onLoad <- function(libname, pkgname) {
22 | op <- options()
23 | op.heRomod <- list(
24 | heRomod.verbose = FALSE,
25 | heRomod.memotime = 3600,
26 | heRomod.inf_parameter = "stop"
27 | )
28 | toset <- !(names(op.heRomod) %in% names(op))
29 | if(any(toset)) options(op.heRomod[toset])
30 |
31 | invisible()
32 | }
33 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 |
3 | coverage:
4 | status:
5 | project:
6 | default:
7 | target: auto
8 | threshold: 1%
9 | patch:
10 | default:
11 | target: auto
12 | threshold: 1%
13 |
--------------------------------------------------------------------------------
/data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/data
--------------------------------------------------------------------------------
/data-raw/save_gho_mortality.R:
--------------------------------------------------------------------------------
1 | library(rgho)
2 | library(heRomod)
3 | library(dplyr)
4 |
5 | countries <- get_gho_codes(dimension = "COUNTRY") %>%
6 | filter_gho(WORLD_BANK_INCOME_GROUP == "High-income")
7 |
8 | get_latest_morta <- function(country) {
9 | message(country)
10 | mr_data <- get_gho_data(
11 | dimension = "GHO",
12 | code = "LIFE_0000000029",
13 | filter = list(
14 | COUNTRY = country
15 | )
16 | )
17 |
18 | if (nrow(mr_data) == 0) return(NULL)
19 |
20 | study_year <- max(mr_data$YEAR)
21 | mr_data_year <- mr_data[mr_data$YEAR == study_year, ]
22 |
23 | if (nrow(mr_data_year) != 44) {
24 | stop("Strange GHO mortality data.")
25 | }
26 |
27 | pooled_data <- heRomod:::pool_data(
28 | mr_data_year,
29 | country = country, year = study_year
30 | )
31 |
32 | list(
33 | data = mr_data_year,
34 | year = study_year,
35 | pool = pooled_data
36 | )
37 | }
38 |
39 |
40 | list_morta <- lapply(countries, get_latest_morta)
41 | names(list_morta) <- countries
42 | list_morta <- Filter(function(x) ! is.null(x), list_morta)
43 |
44 | devtools::use_data(
45 | list_morta,
46 | internal = TRUE,
47 | overwrite = TRUE
48 | )
49 |
--------------------------------------------------------------------------------
/inst/compat/checkimab.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/checkimab.rds
--------------------------------------------------------------------------------
/inst/compat/custompsm.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/custompsm.rds
--------------------------------------------------------------------------------
/inst/compat/fit.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/fit.rds
--------------------------------------------------------------------------------
/inst/compat/groups.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/groups.rds
--------------------------------------------------------------------------------
/inst/compat/markov.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/markov.rds
--------------------------------------------------------------------------------
/inst/compat/psm.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/psm.rds
--------------------------------------------------------------------------------
/inst/compat/ta447.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/compat/ta447.rds
--------------------------------------------------------------------------------
/inst/examples/example_calibration.R:
--------------------------------------------------------------------------------
1 |
2 | param <- define_parameters(p = 0.8)
3 |
4 | mat <- define_transition(
5 | p, C,
6 | 0, 1
7 | )
8 | mod <- define_strategy(
9 | transition = mat,
10 | A = define_state(cost=10, effect = 0.5),
11 | B = define_state(cost = 5, effect = 0.8)
12 | )
13 |
14 | res_mod <- run_model(
15 | mod = mod,
16 | parameters = param,
17 | init = c(1000L, 0L),
18 | cycles = 10,
19 | cost = cost,
20 | effect = effect,
21 | method = "end"
22 | )
23 |
24 | f <- function(x) {
25 | filter(
26 | get_counts(x),
27 | state_names == "A" & markov_cycle == 10
28 | )$count
29 | }
30 | f(res_mod)
31 |
32 | calibrate_model(
33 | res_mod,
34 | parameter_names = "p",
35 | fn_values = f,
36 | target_values = 130,
37 | initial_values = data.frame(p = c(0.5, 0.9)),
38 | lower = 0, upper = 1
39 | )
40 |
--------------------------------------------------------------------------------
/inst/examples/example_define_calibration_fn.R:
--------------------------------------------------------------------------------
1 | example("run_model")
2 |
3 | f <- define_calibration_fn(
4 | type = c("count", "count", "value"),
5 | strategy_names = c("I", "I", "II"),
6 | element_names = c("A", "B", "ly"),
7 | cycles = c(3, 5, 9),
8 | groups = c(1, 1, 2),
9 | aggreg_fn = mean
10 | )
11 |
12 |
--------------------------------------------------------------------------------
/inst/examples/example_define_evppi.R:
--------------------------------------------------------------------------------
1 | evppi.p1 <- define_evppi(
2 | prob1
3 | )
4 | evppi.p1
5 |
--------------------------------------------------------------------------------
/inst/examples/example_define_parameters.R:
--------------------------------------------------------------------------------
1 |
2 | # parameter 'age' depends on time:
3 | # simulating a cohort starting at 60 yo
4 |
5 | define_parameters(
6 | age_start = 60,
7 | age = age_start + markov_cycle
8 | )
9 |
10 | # other uses of markov_cycle are possible
11 |
12 | define_parameters(
13 | top_time = ifelse(markov_cycle < 10, 1, 0)
14 | )
15 |
16 | # more elaborate: risk function
17 |
18 | define_parameters(
19 | rate = 1 - exp(- markov_time * .5)
20 | )
21 |
22 | # dont explicitly state lengths
23 | # define_parameters(
24 | # var = seq(1, 15, 2)
25 | # )
26 |
27 |
28 | # instead rely on markov_cycle or dplyr
29 | # functions such as n() or row_number()
30 |
31 | define_parameters(
32 | var = seq(from = 1, length.out = n(), by = 3),
33 | var2 = seq(1, length(markov_cycle), 2)
34 | )
35 |
36 | param <- define_parameters(
37 | age_start = 60,
38 | age = age_start + markov_cycle
39 | )
40 |
41 | # modify existing parameters
42 |
43 | modify(
44 | param,
45 | age_start = 40
46 | )
47 |
48 | # cannot add new parameters
49 |
50 | # modify(
51 | # param,
52 | # const = 4.4,
53 | # age_2 = age ^ 2
54 | # )
55 |
56 |
--------------------------------------------------------------------------------
/inst/examples/example_define_resample.R:
--------------------------------------------------------------------------------
1 | mc <- define_correlation(
2 | age_init, cost_init, .4
3 | )
4 |
5 | define_psa(
6 | age_init ~ normal(60, 10),
7 | cost_init ~ normal(1000, 100),
8 | correlation = mc
9 | )
10 |
11 | # example with multinomial parameters
12 |
13 | define_psa(
14 | rate1 + rate2 + rate3 ~ multinomial(10, 50, 40),
15 | a + b ~ multinomial(15, 30)
16 | )
17 |
--------------------------------------------------------------------------------
/inst/examples/example_define_state.R:
--------------------------------------------------------------------------------
1 | st <- define_state(
2 | cost = 6453,
3 | utility = .876
4 | )
5 | st
6 |
--------------------------------------------------------------------------------
/inst/examples/example_define_strategy.R:
--------------------------------------------------------------------------------
1 | mat <- define_transition(
2 | state_names = c("s1", "s2"),
3 | 1 / c, 1 - 1/ c,
4 | 0, 1
5 | )
6 |
7 | s1 <- define_state(
8 | cost = 234,
9 | utility = 1
10 | )
11 | s2 <- define_state(
12 | cost = 421,
13 | utility = .5
14 | )
15 |
16 | define_strategy(
17 | transition = mat,
18 | s1 = s1,
19 | s2 = s2
20 | )
21 |
--------------------------------------------------------------------------------
/inst/examples/example_define_transition.R:
--------------------------------------------------------------------------------
1 |
2 | # simple 3x3 transition matrix
3 |
4 | mat_1 <- define_transition(
5 | .2, 0, .8,
6 | 0, .1, .9,
7 | 0, 0, 1
8 | )
9 | mat_1
10 |
11 | plot(mat_1)
12 |
13 | # referencing parameters
14 | # rr must be present in a parameter object
15 | # that must later be linked with define_strategy
16 |
17 | mat_2 <- define_transition(
18 | .5 - rr, rr,
19 | .4, .6
20 | )
21 | mat_2
22 |
23 | reindent_transition(mat_2)
24 |
25 | # can also use C
26 |
27 | define_transition(
28 | C, rr,
29 | .4, .6
30 | )
31 |
32 | # updating cells from mat_1
33 |
34 | modify(
35 | mat_1,
36 | cell_2_1 = .2,
37 | cell_2_3 = .7
38 | )
39 |
40 | # only matrix size is check, it is thus possible
41 | # to define an incorrect matrix
42 |
43 | # this matrix will generate an error later,
44 | # during model evaluation
45 |
46 | define_transition(
47 | .5, 3,
48 | -1, 2
49 | )
50 |
--------------------------------------------------------------------------------
/inst/examples/example_eval_parameters.R:
--------------------------------------------------------------------------------
1 | param <- define_parameters(
2 | age_start = 60,
3 | age = age_start + markov_cycle
4 | )
5 |
6 | heRomod:::eval_parameters(param, cycles = 15)
7 |
--------------------------------------------------------------------------------
/inst/examples/example_eval_strategy.R:
--------------------------------------------------------------------------------
1 | param <- define_parameters(
2 | a = markov_cycle + 1 * 2
3 | )
4 |
5 | mat <- define_transition(
6 | 1-1/a, 1/a,
7 | .1, .9
8 | )
9 |
10 | mod <- define_strategy(
11 | transition = mat,
12 | A = define_state(cost = 10),
13 | B = define_state(cost = 2)
14 | )
15 |
16 | heRomod:::eval_strategy(
17 | strategy = mod,
18 | parameters = param,
19 | init = define_init(A = 10, B = 5),
20 | cycles = 5,
21 | method = "end",
22 | inflow = define_inflow(A = 0, B = 0),
23 | strategy_name = "A",
24 | expand_limit = c(A = 5, B = 5)
25 | )
26 |
--------------------------------------------------------------------------------
/inst/examples/example_eval_strategy_newdata.R:
--------------------------------------------------------------------------------
1 | par1 <- define_parameters(
2 | a = 1,
3 | b = 1 / (markov_cycle + a)
4 | )
5 |
6 | mat1 <- define_transition(
7 | 1-b, b,
8 | 0, 1
9 | )
10 | mod1 <- define_strategy(
11 | transition = mat1,
12 | define_state(var = a),
13 | define_state(var = a * markov_cycle)
14 | )
15 |
16 | res1 <- run_model(
17 | mod1,
18 | parameters = par1,
19 | cycles = 5,
20 | init = 1:0,
21 | method = "end"
22 | )
23 |
24 | new_tab <- data.frame(
25 | a = 1:10
26 | )
27 |
28 | heRomod:::eval_strategy_newdata(
29 | res1,
30 | newdata = new_tab
31 | )
32 |
--------------------------------------------------------------------------------
/inst/examples/example_look_up.R:
--------------------------------------------------------------------------------
1 | tempdf <- expand.grid(arg1 = c("A", "B", "C"), arg2 = 1:4, arg3 = 1:5)
2 | tempdf$value <- 1:60
3 |
4 | look_up(
5 | data = tempdf,
6 | value = "value",
7 | arg1 = c("A", "B", "C", "B", "A"),
8 | arg2 = c(1, 1, 3.2, 3.0, 5),
9 | arg3 = c(-1, 1, 1, 2, 3)
10 | )
11 |
12 | # binning doesnt catch values lesser than the smaller
13 | # reference value
14 | look_up(
15 | data = tempdf,
16 | value = "value",
17 | arg1 = c("A", "B", "C", "B", "A"),
18 | arg2 = c(1, 1, 3.2, 3.0, 5),
19 | arg3 = c(-1, 1, 1, 2, 3),
20 | bin = TRUE
21 | )
22 | # bin can alos be given as a charater vector
23 | # to avoid binning all numeric variables
24 | look_up(
25 | data = tempdf,
26 | value = "value",
27 | arg1 = c("A", "B", "C", "B", "A"),
28 | arg2 = c(1, 1, 3.2, 3.0, 5),
29 | arg3 = c(-1, 1, 1, 2, 3),
30 | bin = c("arg2")
31 | )
32 |
33 | age_related_df <- data.frame(age = 10 * 0:9, decade = 1:10)
34 |
35 | look_up(age_related_df, age = c(0, 10, 20), value = "decade")
36 |
37 | # binning might help in the situation
38 | look_up(age_related_df, age = c(5, 15, 23.5),
39 | value = "decade")
40 | look_up(age_related_df, age = c(5, 15, 23.5),
41 | value = "decade", bin = TRUE)
42 |
--------------------------------------------------------------------------------
/inst/examples/example_plot.run_model.R:
--------------------------------------------------------------------------------
1 |
2 | ## These examples require \code{res_mod} from the hip replacement model discussed in
3 | ## `vignette("non-homogeneous", package = "heRomod")`.
4 |
5 | \dontrun{
6 | plot(res_mod)
7 |
8 | plot(res_mod, model = "all")
9 | plot(res_mod, model = "all", panels = "by_state")
10 |
11 | plot(res_mod, model = "all", include_states = c("RevisionTHR", "SuccessR"))
12 | plot(res_mod, model = "all", panels = "by_state", include_states = c("RevisionTHR", "SuccessR"))
13 |
14 | plot(res_mod, model = 2, panel = "by_state", include_states = c("RevisionTHR", "SuccessR"))
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/inst/examples/example_run_dsa.R:
--------------------------------------------------------------------------------
1 | param <- define_parameters(
2 | p1 = .5,
3 | p2 = .2,
4 | r = .05
5 | )
6 | mod1 <- define_strategy(
7 | transition = define_transition(
8 | C, p1,
9 | p2, C
10 | ),
11 | define_state(
12 | cost = discount(543, r),
13 | ly = 1
14 | ),
15 | define_state(
16 | cost = discount(432, r),
17 | ly = .5
18 | )
19 | )
20 |
21 | mod2 <- define_strategy(
22 | transition = define_transition(
23 | C, p1,
24 | p2, C
25 | ),
26 | define_state(
27 | cost = 789,
28 | ly = 1
29 | ),
30 | define_state(
31 | cost = 456,
32 | ly = .8
33 | )
34 | )
35 |
36 | res2 <- run_model(
37 | mod1, mod2,
38 | parameters = param,
39 | init = c(100, 0),
40 | cycles = 10,
41 | cost = cost,
42 | effect = ly
43 | )
44 |
45 | ds <- define_dsa(
46 | p1, .1, .9,
47 | p2, .1, .3,
48 | r, .05, .1
49 | )
50 | print(ds)
51 |
52 | x <- run_dsa(res2, ds)
53 |
54 | plot(x, value = "cost")
55 |
56 | # can be specified as a function of other parameters
57 |
58 |
59 | ds2 <- define_dsa(
60 | p2, p1 - .1, p1 + .1
61 | )
62 |
63 | run_dsa(res2, ds2)
64 |
--------------------------------------------------------------------------------
/inst/examples/example_run_model.R:
--------------------------------------------------------------------------------
1 | # running a single model
2 |
3 | mod1 <-
4 | define_strategy(
5 | transition = define_transition(
6 | .5, .5,
7 | .1, .9
8 | ),
9 | define_state(
10 | cost = 543,
11 | ly = 1
12 | ),
13 | define_state(
14 | cost = 432,
15 | ly = 1
16 | )
17 | )
18 |
19 |
20 | res <- run_model(
21 | mod1,
22 | init = c(100, 0),
23 | cycles = 2,
24 | cost = cost,
25 | effect = ly
26 | )
27 |
28 | # running several models
29 | mod2 <-
30 | define_strategy(
31 | transition = define_transition(
32 | .5, .5,
33 | .1, .9
34 | ),
35 | define_state(
36 | cost = 789,
37 | ly = 1
38 | ),
39 | define_state(
40 | cost = 456,
41 | ly = 1
42 | )
43 |
44 | )
45 |
46 |
47 | res2 <- run_model(
48 | mod1, mod2,
49 | init = c(100, 0),
50 | cycles = 10,
51 | cost = cost,
52 | effect = ly
53 | )
54 |
--------------------------------------------------------------------------------
/inst/examples/example_run_psa.R:
--------------------------------------------------------------------------------
1 | # example for run_psa
2 |
3 | mod1 <- define_strategy(
4 | transition = define_transition(
5 | .5, .5,
6 | .1, .9
7 | ),
8 | define_state(
9 | cost = cost_init + age * 5,
10 | ly = 1
11 | ),
12 | define_state(
13 | cost = cost_init + age,
14 | ly = 0
15 | )
16 | )
17 |
18 | mod2 <- define_strategy(
19 | transition = define_transition(
20 | p_trans, C,
21 | .1, .9
22 | ),
23 | define_state(
24 | cost = 789 * age / 10,
25 | ly = 1
26 | ),
27 | define_state(
28 | cost = 456 * age / 10,
29 | ly = 0
30 | )
31 |
32 | )
33 |
34 | res2 <- run_model(
35 | mod1, mod2,
36 | parameters = define_parameters(
37 | age_init = 60,
38 | cost_init = 1000,
39 | age = age_init + markov_cycle,
40 | p_trans = .7
41 | ),
42 | init = 1:0,
43 | cycles = 10,
44 | cost = cost,
45 | effect = ly
46 | )
47 |
48 | rsp <- define_psa(
49 | age_init ~ normal(60, 10),
50 | cost_init ~ normal(1000, 100),
51 | p_trans ~ binomial(.7, 100),
52 | correlation = matrix(c(
53 | 1, .4, 0,
54 | .4, 1, 0,
55 | 0, 0, 1
56 | ), byrow = TRUE, ncol = 3)
57 | )
58 |
59 |
60 | # with run_model result
61 | # (only 10 resample for speed)
62 | ndt1 <- run_psa(res2, psa = rsp, N = 10)
63 |
--------------------------------------------------------------------------------
/inst/examples/example_transform.R:
--------------------------------------------------------------------------------
1 | # convert 5-year probability
2 | # to 1-year probability
3 | rescale_prob(p = .65, from = 5)
4 |
5 | # convert 1-year probability
6 | # to 1-month probability
7 | rescale_prob(p = .5, to = 1/12)
8 |
9 | # convert rate per 1000 PY
10 | # to 5-year probability
11 | rate_to_prob(r = 162, per = 1000, to = 5)
12 |
13 | # convert OR to probability
14 | or_to_prob(or = 1.9, p = .51)
15 |
16 | # convert RR to probability
17 | rr_to_prob(rr = 1.9, p = .51)
18 |
--------------------------------------------------------------------------------
/inst/examples/example_update.R:
--------------------------------------------------------------------------------
1 | mod1 <-
2 | define_strategy(
3 | transition = define_transition(
4 | .5, .5,
5 | .1, .9
6 | ),
7 | define_state(
8 | cost = 543 + age * 5,
9 | ly = 1
10 | ),
11 | define_state(
12 | cost = 432 + age,
13 | ly = 1 * age / 100
14 | )
15 | )
16 |
17 | mod2 <-
18 | define_strategy(
19 | transition = define_transition(
20 | .5, .5,
21 | .1, .9
22 | ),
23 | define_state(
24 | cost = 789 * age / 10,
25 | ly = 1
26 | ),
27 | define_state(
28 | cost = 456 * age / 10,
29 | ly = 1 * age / 200
30 | )
31 | )
32 |
33 | res <- run_model(
34 | mod1, mod2,
35 | parameters = define_parameters(
36 | age_init = 60,
37 | age = age_init + markov_cycle
38 | ),
39 | init = 1:0,
40 | cycles = 10,
41 | cost = cost,
42 | effect = ly
43 | )
44 |
45 | # generating table with new parameter sets
46 | new_tab <- data.frame(
47 | age_init = 40:45
48 | )
49 |
50 | # with run_model result
51 | ndt <- update(res, newdata = new_tab)
52 |
53 | summary(ndt)
54 |
55 | # using weights
56 |
57 | new_tab2 <- data.frame(
58 | age_init = 40:45,
59 | .weights = runif(6)
60 | )
61 | ndt2 <- update(res, newdata = new_tab2)
62 |
63 | summary(ndt2)
64 |
--------------------------------------------------------------------------------
/inst/hero/advanced_surv_modeling/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/advanced_surv_modeling/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/advanced_surv_modeling/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/advanced_surv_modeling/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/advanced_surv_modeling/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/advanced_surv_modeling/model.rds
--------------------------------------------------------------------------------
/inst/hero/advanced_surv_modeling/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/advanced_surv_modeling/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/example_simple_psm/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/example_simple_psm/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/example_simple_psm/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/example_simple_psm/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/example_simple_psm/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/example_simple_psm/model.rds
--------------------------------------------------------------------------------
/inst/hero/example_simple_psm/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/example_simple_psm/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/model.rds
--------------------------------------------------------------------------------
/inst/hero/groups/scen_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/scen_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/scen_vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/scen_vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/twsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/twsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/groups/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/groups/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/.DS_Store
--------------------------------------------------------------------------------
/inst/hero/markov_model/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/model.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/scen_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/scen_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/scen_vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/scen_vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/twsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/twsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/markov_model/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/markov_model/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/psm_responders/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/psm_responders/.DS_Store
--------------------------------------------------------------------------------
/inst/hero/psm_responders/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/psm_responders/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/psm_responders/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/psm_responders/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/psm_responders/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/psm_responders/model.rds
--------------------------------------------------------------------------------
/inst/hero/psm_responders/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/psm_responders/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/model.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/psa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/psa_res.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/scen_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/scen_res.rds
--------------------------------------------------------------------------------
/inst/hero/shared_st/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/shared_st/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/sparse/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/sparse/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/sparse/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/sparse/model.rds
--------------------------------------------------------------------------------
/inst/hero/ta447/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/ta447/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/ta447/dsa_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/ta447/dsa_res.rds
--------------------------------------------------------------------------------
/inst/hero/ta447/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/ta447/model.rds
--------------------------------------------------------------------------------
/inst/hero/ta447/vbp_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/ta447/vbp_res.rds
--------------------------------------------------------------------------------
/inst/hero/time-dependency/bc_res.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/time-dependency/bc_res.rds
--------------------------------------------------------------------------------
/inst/hero/time-dependency/model.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/hero/time-dependency/model.rds
--------------------------------------------------------------------------------
/inst/media/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/media/logo.png
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncOptions.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,lifeyear
4 | method,life-table
5 | cycles,100
6 | n,1000
7 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncParams.csv:
--------------------------------------------------------------------------------
1 | parameter,value
2 | km_until,0
3 | pfs.tr.A,"get_surv_probs(PFS.fit, ""A"", km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
4 | os.tr.A,"get_surv_probs(OS.fit, ""A"", km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
5 | pfs.tr.B,"get_surv_probs(PFS.fit, ""B"", km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
6 | os.tr.B,"get_surv_probs(OS.fit, ""B"", km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
7 | utility.dr,0.000671233
8 | cost.dr,0.000671233
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncParams_explicit_dists.csv:
--------------------------------------------------------------------------------
1 | parameter,value
2 | ,
3 | use_rate,0.025
4 | pfs.tr.A,"get_surv_probs(explicit_dist(dist_name = ""exp"", rate = 1/100), treatment = NULL, km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
5 | pfs.tr.B,"get_surv_probs(explicit_dist(dist_name = ""exp"", rate = use_rate), treatment = NULL, km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
6 | os.tr.A,"get_surv_probs(explicit_dist(dist_name = ""exp"", rate = 1/75), treatment = NULL, km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
7 | os.tr.B,"get_surv_probs(explicit_dist(dist_name = ""exp"", rate = 1/20), treatment = NULL, km_until = km_until, markov_cycle = markov_cycle, markov_cycle_length = 1, pred_type = ""prob"")"
8 | utility.dr,0.000671233
9 | cost.dr,0.000671233
10 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncParams_nomatrix.csv:
--------------------------------------------------------------------------------
1 | parameter,value
2 | km_until,0
3 | ,
4 | utility.dr,0.000671233
5 | cost.dr,0.000671233
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | tm,survival_info.csv
4 | parameters,example_oncParams.csv
5 | ,
6 | data,required_info
7 | demographics,example_demographics.csv
8 | output,output
9 | options,example_oncOptions.csv
10 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_explicit_dists.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams_explicit_dists.csv
4 | tm,survival_info_explicit_dists.csv
5 | output,output-nomatrix
6 | options,example_oncOptions.csv
7 | use_fits,use_fits_explicit_dists.csv
8 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_mixed.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams_nomatrix.csv
4 | tm,survival_info.csv
5 | ,
6 | output,output-nomatrix
7 | options,example_oncOptions.csv
8 | use_fits,use_fits_mixed.csv
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_nomatrix.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams_nomatrix.csv
4 | tm,survival_info.csv
5 | ,
6 | output,output-nomatrix
7 | options,example_oncOptions.csv
8 | use_fits,use_fits.csv
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_nomatrix_join.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams_nomatrix.csv
4 | tm,survival_info.csv
5 | ,
6 | output,output-nomatrix
7 | options,example_oncOptions.csv
8 | use_fits,use_fits_join.csv
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_nomatrix_run.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams.csv
4 | tm,survival_info_nomatrix_run.csv
5 | options,example_oncOptions.csv
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncSpecs_test_part_surv.csv:
--------------------------------------------------------------------------------
1 | data,file
2 | state,example_oncStates.csv
3 | parameters,example_oncParams_nomatrix.csv
4 | tm,fake_fit_tib.csv
5 | ,
6 | output,output-nomatrix
7 | options,example_oncOptions.csv
8 | use_fits,use_fits.csv
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncStates.csv:
--------------------------------------------------------------------------------
1 | .model,.state,lifeyear,utility,cost,.discount.utility,.discount.cost
2 | A,ProgressionFree,1,0.85,250,utility.dr,cost.dr
3 | A,ProgressiveDisease,1,0.65,0,utility.dr,cost.dr
4 | A,Death,0,0,0,utility.dr,cost.dr
5 | B,ProgressionFree,1,0.8,200,utility.dr,cost.dr
6 | B,ProgressiveDisease,1,0.6,0,utility.dr,cost.dr
7 | B,Death,0,0,0,utility.dr,cost.dr
8 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_oncTransitionProbs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | A,ProgressionFree,ProgressionFree,1 - pfs.tr.A
3 | A,ProgressionFree,ProgressiveDisease,pfs.tr.A - os.tr.A
4 | A,ProgressionFree,Terminal,os.tr.A
5 | A,ProgressiveDisease,ProgressiveDisease,1 - os.tr.A
6 | A,ProgressiveDisease,Terminal,os.tr.A
7 | A,Terminal,Death,1
8 | A,Death,Death,1
9 | B,ProgressionFree,ProgressionFree,1 - pfs.tr.B
10 | B,ProgressionFree,ProgressiveDisease,pfs.tr.B - os.tr.B
11 | B,ProgressionFree,Terminal,os.tr.B
12 | B,ProgressiveDisease,ProgressiveDisease,1 - os.tr.B
13 | B,ProgressiveDisease,Terminal,os.tr.B
14 | B,Terminal,Death,1
15 | B,Death,Death,1
16 |
--------------------------------------------------------------------------------
/inst/tabular/surv/example_use_fits_explicit_dists.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist
2 | A,pfs,"define_survival(distribution = ""exp"", rate = 0.0338)"
3 | A,os,"define_survival(distribution = ""exp"", rate = 0.0151)"
4 | B,pfs,"define_survival(distribution = ""exp"", rate = 0.0483)"
5 | B,os,"define_survival(distribution = ""exp"", rate = 0.0215)"
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/fake_fit_tib.csv:
--------------------------------------------------------------------------------
1 | type,treatment,set_name,dist,fit,set_def
2 | PFS,A,all,exp,fake_fit,TRUE
3 | PFS,A,all,weibull,fake_fit,TRUE
4 | PFS,A,all,lnorm,fake_fit,TRUE
5 | PFS,A,all,gamma,fake_fit,TRUE
6 | PFS,A,all,gompertz,fake_fit,TRUE
7 | PFS,A,all,gengamma,fake_fit,TRUE
8 | PFS,A,all,km,fake_fit,TRUE
9 | OS,A,all,exp,fake_fit,TRUE
10 | OS,A,all,weibull,fake_fit,TRUE
11 | OS,A,all,lnorm,fake_fit,TRUE
12 | OS,A,all,gamma,fake_fit,TRUE
13 | OS,A,all,gompertz,fake_fit,TRUE
14 | OS,A,all,gengamma,fake_fit,TRUE
15 | OS,A,all,km,fake_fit,TRUE
16 | PFS,B,all,exp,fake_fit,TRUE
17 | PFS,B,all,weibull,fake_fit,TRUE
18 | PFS,B,all,lnorm,fake_fit,TRUE
19 | PFS,B,all,gamma,fake_fit,TRUE
20 | PFS,B,all,gompertz,fake_fit,TRUE
21 | PFS,B,all,gengamma,fake_fit,TRUE
22 | PFS,B,all,km,fake_fit,TRUE
23 | OS,B,all,exp,fake_fit,TRUE
24 | OS,B,all,weibull,fake_fit,TRUE
25 | OS,B,all,lnorm,fake_fit,TRUE
26 | OS,B,all,gamma,fake_fit,TRUE
27 | OS,B,all,gompertz,fake_fit,TRUE
28 | OS,B,all,gengamma,fake_fit,TRUE
29 | OS,B,all,km,fake_fit,TRUE
30 |
--------------------------------------------------------------------------------
/inst/tabular/surv/set_definitions_1.csv:
--------------------------------------------------------------------------------
1 | treatment,set_name,condition,subtract_time
2 | fake_treatment,all,TRUE,
3 | not_real,all,TRUE,
4 | fake_treatment,time.gt.100,time > 100,100
5 | not_real,time.gt.100,time > 100,100
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/set_definitions_2.csv:
--------------------------------------------------------------------------------
1 | treatment,set_name,condition
2 | fake_treatment,all,TRUE
3 |
--------------------------------------------------------------------------------
/inst/tabular/surv/set_definitions_error_1.csv:
--------------------------------------------------------------------------------
1 | treatments,set_Name,condition,subtract_time
2 | fake_treatment,all,TRUE,
3 | not_real,all,TRUE,
4 | fake_treatment,time.gt.100,time > 100,100
5 | not_real,time.gt.100,time > 100,100
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/surv_def_ok.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist,until
2 | A,pfs,fit('km'),100
3 | A,pfs,fit('exp'),NA
4 | A,os,fit('km'),100
5 | A,os,fit('exp'),NA
6 | B,pfs,fit('km'),100
7 | B,pfs,fit('exp'),NA
8 | B,os,fit('km'),100
9 | B,os,fit('exp'),NA
10 |
--------------------------------------------------------------------------------
/inst/tabular/surv/surv_table.csv:
--------------------------------------------------------------------------------
1 | time,survival
2 | 0,1
3 | 1,0.9
4 | 5,0.7
5 | 10,0.4
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/OS.A.surv.fits.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/surv/survival_data/OS.A.surv.fits.RData
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/OS.B.surv.fits.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/surv/survival_data/OS.B.surv.fits.RData
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/PFS.A.surv.fits.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/surv/survival_data/PFS.A.surv.fits.RData
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/PFS.B.surv.fits.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/surv/survival_data/PFS.B.surv.fits.RData
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/set_def_pfs_os.csv:
--------------------------------------------------------------------------------
1 | treatment,type,set_name,condition,time_subtract
2 | A,pfs,all,TRUE,
3 | B,pfs,all,TRUE,
4 | A,pfs,GT50,time > 50,50
5 | B,pfs,GT50,time > 50,50
6 | B,pfs,B5,biomarker > 0.5,0
7 | A,os,all,TRUE,
8 | B,os,all,TRUE,
9 | B,os,B5,biomarker > 0.5,0
10 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_data/set_definitions.csv:
--------------------------------------------------------------------------------
1 | treatment,set_name,condition,time_subtract
2 | A,all,TRUE,
3 | B,all,TRUE,
4 | A,GT50,time > 50,50
5 | B,GT50,time > 50,50
6 | B,B5,biomarker > 0.5,0
7 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_info.csv:
--------------------------------------------------------------------------------
1 | type,treatment,data_directory,data_file,fit_directory,fit_name,fit_file,time_col,treatment_col,censor_col,event_code,censor_code
2 | PFS,A,survival_data,surv_data_PFS.csv,survival_data,PFS.A.fit,PFS.A.surv.fits,time,treatment,status,1,0
3 | PFS,B,survival_data,surv_data_PFS.csv,survival_data,PFS.B.fit,PFS.B.surv.fits,time,treatment,status,1,0
4 | OS,A,survival_data,surv_data_OS.csv,survival_data,OS.A.fit,OS.A.surv.fits,time,treatment,status,1,0
5 | OS,B,survival_data,surv_data_OS.csv,survival_data,OS.B.fit,OS.B.surv.fits,time,treatment,status,1,0
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_info_eventcode.csv:
--------------------------------------------------------------------------------
1 | type,treatment,data_directory,data_file,fit_directory,fit_name,fit_file,time_col,treatment_col,censor_col,event_code,censor_code
2 | PFS,A,survival_data,surv_data_PFS_eventcode.csv,survival_data,PFS.A.fit,PFS.A.surv.fits,time,treatment,status,event,censored
3 | PFS,B,survival_data,surv_data_PFS_eventcode.csv,survival_data,PFS.B.fit,PFS.B.surv.fits,time,treatment,status,event,censored
4 | OS,A,survival_data,surv_data_OS_eventcode.csv,survival_data,OS.A.fit,OS.A.surv.fits,time,treatment,status,event,censored
5 | OS,B,survival_data,surv_data_OS_eventcode.csv,survival_data,OS.B.fit,OS.B.surv.fits,time,treatment,status,event,censored
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_info_eventcode_error.csv:
--------------------------------------------------------------------------------
1 | type,treatment,data_directory,data_file,fit_directory,fit_name,fit_file,time_col,treatment_col,censor_col,event_code,censor_code
2 | PFS,A,survival_data,surv_data_PFS.csv,survival_data,PFS.A.fit,PFS.A.surv.fits,time,treatment,status,event,censor
3 | PFS,B,survival_data,surv_data_PFS.csv,survival_data,PFS.B.fit,PFS.B.surv.fits,time,treatment,status,event,censor
4 | OS,A,survival_data,surv_data_OS.csv,survival_data,OS.A.fit,OS.A.surv.fits,time,treatment,status,event,censor
5 | OS,B,survival_data,surv_data_OS.csv,survival_data,OS.B.fit,OS.B.surv.fits,time,treatment,status,event,censor
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_info_explicit_dists.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | survivalDataDirectory,survival_data
3 | fit_metric,AIC
4 | fit_name_pfs,PFS.fit
5 | fit_file_pfs,PFS.surv.fit
6 | fit_name_ofs,OS.fit
7 | fit_file_ofs,OS.surv.fit
8 |
--------------------------------------------------------------------------------
/inst/tabular/surv/survival_info_nomatrix_run.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | survivalDataDirectory,survival_data
3 | fit_metric,AIC
4 | fit_name_pfs,PFS.fit
5 | surv_data_file_pfs,surv_data_PFS.csv
6 | fit_name_ofs,OS.fit
7 | surv_data_file_ofs,surv_data_OS.csv
8 | treatment_col_name,trt
9 |
--------------------------------------------------------------------------------
/inst/tabular/surv/use_fits.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist
2 | A,pfs,fit('exp')
3 | A,os,fit('exp')
4 | B,pfs,fit('exp')
5 | B,os,fit('exp')
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/use_fits_example0.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist
2 | A,pfs,fit('gamma')
3 | A,os,fit('exp')
4 | B,pfs,fit('lnorm')
5 | B,os,fit('exp')
6 |
--------------------------------------------------------------------------------
/inst/tabular/surv/use_fits_join.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist,.subset,until
2 | A,pfs,fit('km'),all,50
3 | A,pfs,fit('exp'),all,
4 | A,os,fit('km'),all,50
5 | A,os,fit('exp'),all,
6 | B,pfs,fit('km'),all,50
7 | B,pfs,fit('exp'),GT50,
8 | B,os,fit('km'),all,50
9 | B,os,fit('exp'),GT50,
10 |
--------------------------------------------------------------------------------
/inst/tabular/surv/use_fits_mixed.csv:
--------------------------------------------------------------------------------
1 | .strategy,.type,dist
2 | A,pfs,"define_survival(distribution = ""exp"", rate = 1/100)"
3 | A,os,fit('exp')
4 | B,pfs,fit('exp')
5 | B,os,fit('exp')
6 |
--------------------------------------------------------------------------------
/inst/tabular/test/.gitignore:
--------------------------------------------------------------------------------
1 | edited_ref.csv
2 |
--------------------------------------------------------------------------------
/inst/tabular/test/REFERENCE_1probmissing.csv:
--------------------------------------------------------------------------------
1 | data,file,.comment,.comment2
2 | state,THR_test_states.csv,list of states and their costs and effects,
3 | tm,THR_test_transition_probs_1missing.csv,transition probabilities,
4 | parameters,THR_parameters.csv,parameters of the models,
5 | ,,,
6 | data,input_dataframes,folder that stores the dataframes to be input,input_dataframes
7 | output,output,folder to store outputs,
8 | options,THR_options.csv,model options,
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/REFERENCE_missingfunctions.csv:
--------------------------------------------------------------------------------
1 | data,file,.comment,.comment2
2 | state,THR_test_states.csv,list of states and their costs and effects,
3 | tm,THR_test_transition_probs.csv,transition probabilities,
4 | parameters,THR_parameters.csv,parameters of the models,
5 | ,,,
6 | output,output,folder to store outputs,
7 | options,THR_options.csv,model options,
8 | source,notpresent
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_options.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,100
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_parameters.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa,.comment
2 | lngamma,0.3740968,0.2791966,0.468997,"normal(0.27, 0.001)",
3 | gamma,exp(lngamma),,,,
4 | constant,-5.490935,-5.906719,-5.075151,,
5 | agecoef,-0.0367022,-0.0471246,-0.0262798,"normal(-0.04, 0.001)",
6 | malecoef,0.768536,0.550404,0.986668,,
7 | np1,-1.344474,-2.109637,-0.579311,,
8 | rr,exp(np1),0.121282,0.5602843,"binomial(0.12, 500)",
9 | age_init,60,,,,
10 | age,age_init + markov_cycle,,,,
11 | sex,0,,,,
12 | sex_str,"ifelse(sex==1, ""Males"", ""Females"")",,,,
13 | mr,"look_up(mr_table, age = age, sex = sex_str, bin = TRUE, value = ""value"")",,,,
14 | lambdaStandard,exp(constant + agecoef * age_init + malecoef * sex),,,,
15 | lambdaNew,exp(constant + agecoef * age_init + malecoef * sex) * rr,,,,
16 | pHRFailStandard,1 - exp(lambdaStandard * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
17 | pHRFailNew,1 - exp(lambdaNew * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
18 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_test_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.01
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | new,PrimaryTHR,0,0,0.01
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_test_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
7 | standard,SuccessfulPrimary,Death,mr
8 | standard,RevisionTHR,SuccessfulRevision,C
9 | standard,RevisionTHR,Death,0.02
10 | standard,SuccessfulRevision,SuccessfulRevision,C
11 | standard,SuccessfulRevision,RevisionTHR,0.04
12 | standard,SuccessfulRevision,Death,mr
13 | standard,Death,Death,1
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_test_transition_probs_1missing.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
7 | standard,SuccessfulPrimary,Death,mr
8 | standard,RevisionTHR,SuccessfulRevision,
9 | standard,RevisionTHR,Death,0.02
10 | standard,SuccessfulRevision,SuccessfulRevision,C
11 | standard,SuccessfulRevision,RevisionTHR,0.04
12 | standard,SuccessfulRevision,Death,mr
13 | standard,Death,Death,1
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_test_transition_probs_2.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
7 | standard,SuccessfulPrimary,Death,mr
8 | standard,RevisionTHR,SuccessfulRevision,C
9 | standard,RevisionTHR,Death,0.02
10 | standard,SuccessfulRevision,SuccessfulRevision,C
11 | standard,SuccessfulRevision,RevisionTHR,0.04
12 | standard,SuccessfulRevision,Death,mr
13 | new,Death,Death,1
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/THR_test_transition_probs_bad.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
7 | standard,SuccessfulPrimary,Death,mr
8 | standard,RevisionTHR,SuccessfulRevision,C
9 | standard,RevisionTHR,Death,0.02
10 | standard,SuccessfulRevision,SuccessfulRevision,C
11 | standard,SuccessfulRevision,RevisionTHR,0.04
12 | standard,SuccessfulRevision,Death,mr
13 |
--------------------------------------------------------------------------------
/inst/tabular/test/bad_REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "state","THR_states.csv","list of states and their costs and effects",
4 | "tm","THR_transition_probs.csv","transition probabilities",
5 | "parameters","THR_parameters.csv","parameters of the models",
6 | "demographics","THR_demographic_table.csv","demographic file",
7 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
8 | "output","output","folder to store outputs",
9 | "options","THR_options.csv","model options",
10 |
--------------------------------------------------------------------------------
/inst/tabular/test/example_multinom_params.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa
2 | p_AA,721,700,750,"binomial(.7, 1000)"
3 | p_AB + p_AC + p_AD,,,,"multinomial(202, 67, 10)"
4 |
--------------------------------------------------------------------------------
/inst/tabular/test/example_multinom_params_dup_name.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa
2 | p_AA,721,700,750,"binomial(.7, 1000)"
3 | p_AB,0.724,,,
4 | p_AB + p_AC + p_AD,,,,"multinomial(202, 67, 10)"
5 |
--------------------------------------------------------------------------------
/inst/tabular/test/survival_spec_1.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | survivalDataDirectory,survival_data
3 | fit_metric,AIC
4 | fit_name_pfs,PFS.fit
5 | surv_data_file_pfs,PFS.data.csv
6 | fit_file_pfs,PFS.surv.fit
7 | fit_name_os,OS.fit
8 | surv_data_file_os,OS.data.csv
9 | fit_file_os,OS.surv.fit
10 | output,output
11 |
--------------------------------------------------------------------------------
/inst/tabular/test/survival_spec_2.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | survivalDataDirectory,survival_data
3 | fit_metric,AIC
4 | fit_name_pfs,PFS.fit
5 | surv_data_file_os,OS.data.csv
6 | fit_file_pfs,PFS.surv.fit
7 | fit_name_os,OS.fit
8 | surv_data_file_pfs,PFS.data.csv
9 | fit_file_os,OS.surv.fit
10 | output,output
11 |
--------------------------------------------------------------------------------
/inst/tabular/test/survival_spec_error_1.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | fit_metric,AIC
3 | fit_name_pfs,PFS.fit
4 | surv_data_file_Pfs,PFS.data.csv
5 | fit_file_pfs,PFS.surv.fit
6 | fit_name_ofs,OS.fit
7 | surv_data_file_ofs,OS.data.csv
8 | fit_file_ofs,OS.surv.fit
9 | output,output
10 |
--------------------------------------------------------------------------------
/inst/tabular/test/survival_spec_error_2.csv:
--------------------------------------------------------------------------------
1 | data,val
2 | fit_metric,AIC
3 | fit_name_pfs,PFS.fit
4 | fit_file_pfs,PFS.surv.fit
5 | fit_name_ofs,OS.fit
6 | surv_data_file_pfs,PFS.data.csv
7 | fit_file_ofs,OS.surv.fit
8 | output,output
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_diff_mod_name/REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "tm","THR_transition_probs.csv","transition probabilities",
4 | "parameters","THR_parameters.csv","parameters of the models",
5 | "demographics","THR_demographic_table.csv","demographic file",
6 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
7 | "output","output","folder to store outputs",
8 | "options","THR_options.csv","model options",
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_diff_mod_name/THR_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.015
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | newzzz,PrimaryTHR,0,0,0.015
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_diff_mod_name/THR_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | standard,SuccessfulPrimary,Death,mr
7 | standard,RevisionTHR,SuccessfulRevision,C
8 | standard,RevisionTHR,Death,0.02+mr
9 | standard,SuccessfulRevision,SuccessfulRevision,C
10 | standard,SuccessfulRevision,RevisionTHR,0.04
11 | standard,SuccessfulRevision,Death,mr
12 | standard,Death,Death,1
13 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "tm","THR_transition_probs.csv","transition probabilities",
4 | "parameters","THR_parameters.csv","parameters of the models",
5 | "demographics","THR_demographic_table.csv","demographic file",
6 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
7 | "options","THR_options.csv","model options",
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/THR_demographic_table.csv:
--------------------------------------------------------------------------------
1 | age_init,sex,.weights
2 | 60,1,0.014443906
3 | 61,1,0.019486162
4 | 62,1,0.022763342
5 | 63,1,0.014830844
6 | 64,1,0.006531244
7 | 65,1,0.016355119
8 | 66,1,0.027715524
9 | 67,1,0.013649712
10 | 68,1,0.010988645
11 | 69,1,0.020108026
12 | 70,1,0.003012902
13 | 71,1,0.023422545
14 | 72,1,0.004124414
15 | 73,1,0.018006261
16 | 74,1,0.013104511
17 | 75,1,0.025255571
18 | 76,1,0.026031737
19 | 77,1,0.012071932
20 | 78,1,0.013005982
21 | 79,1,0.028466041
22 | 80,1,0.003391318
23 | 81,1,0.011968808
24 | 82,1,0.012816607
25 | 83,1,0.022359495
26 | 84,1,0.010859407
27 | 85,1,0.026315259
28 | 86,1,0.019319913
29 | 87,1,0.018977731
30 | 88,1,0.02033665
31 | 89,1,0.003011844
32 | 90,1,0.005254821
33 | 60,2,0.016832963
34 | 61,2,0.022643106
35 | 62,2,0.019134093
36 | 63,2,0.012305199
37 | 64,2,0.00218986
38 | 65,2,0.020048466
39 | 66,2,0.008035867
40 | 67,2,0.003641619
41 | 68,2,0.004069419
42 | 69,2,0.02847705
43 | 70,2,0.030920114
44 | 71,2,0.012431315
45 | 72,2,0.012116913
46 | 73,2,0.007329919
47 | 74,2,0.015104434
48 | 75,2,0.006863588
49 | 76,2,0.030033388
50 | 77,2,0.021438696
51 | 78,2,0.02237086
52 | 79,2,0.017010109
53 | 80,2,0.01540871
54 | 81,2,0.028309092
55 | 82,2,0.019318632
56 | 83,2,0.030142101
57 | 84,2,0.027644188
58 | 85,2,0.005828101
59 | 86,2,0.020199233
60 | 87,2,0.005647923
61 | 88,2,0.021849929
62 | 89,2,0.023390694
63 | 90,2,0.001278146
64 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/THR_options.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,100
8 | init,"1000, 0, 0, 0, 0"
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/THR_parameters.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa,.comment
2 | lngamma,0.3740968,0.2791966,0.468997,"normal(0.27, 0.001)",
3 | gamma,exp(lngamma),,,,
4 | constant,-5.490935,-5.906719,-5.075151,,
5 | agecoef,-0.0367022,-0.0471246,-0.0262798,"normal(-0.04, 0.001)",
6 | malecoef,0.768536,0.550404,0.986668,,
7 | np1,-1.344474,-2.109637,-0.579311,,
8 | rr,exp(np1),0.121282,0.5602843,"prop(0.12, 500)",
9 | age_init,60,,,,
10 | age,age_init + markov_cycle,,,,
11 | sex,0,,,,
12 | sex_str,"ifelse(sex==1, ""Males"", ""Females"")",,,,
13 | mr,"look_up(mr_table, age = age, sex = sex_str, bin = TRUE, value = ""value"")",,,,
14 | lambdaStandard,exp(constant + agecoef * age_init + malecoef * sex),,,,
15 | lambdaNew,exp(constant + agecoef * age_init + malecoef * sex) * rr,,,,
16 | pHRFailStandard,1 - exp(lambdaStandard * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
17 | pHRFailNew,1 - exp(lambdaNew * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
18 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/THR_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.015
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | new,PrimaryTHR,0,0,0.015
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/THR_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | standard,SuccessfulPrimary,Death,mr
7 | standard,RevisionTHR,SuccessfulRevision,C
8 | standard,RevisionTHR,Death,0.02+mr
9 | standard,SuccessfulRevision,SuccessfulRevision,C
10 | standard,SuccessfulRevision,RevisionTHR,0.04
11 | standard,SuccessfulRevision,Death,mr
12 | standard,Death,Death,1
13 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_output_dir/input_dataframes/mr_table.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/test_no_output_dir/input_dataframes/mr_table.xlsx
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "tm","THR_transition_probs.csv","transition probabilities",
4 | "parameters","THR_parameters.csv","parameters of the models",
5 | "demographics","THR_demographic_table.csv","demographic file",
6 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
7 | "output","output","folder to store outputs",
8 | "options","THR_options.csv","model options",
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/THR_demographic_table.csv:
--------------------------------------------------------------------------------
1 | age_init,sex,.weights
2 | 60,1,0.014443906
3 | 61,1,0.019486162
4 | 62,1,0.022763342
5 | 63,1,0.014830844
6 | 64,1,0.006531244
7 | 65,1,0.016355119
8 | 66,1,0.027715524
9 | 67,1,0.013649712
10 | 68,1,0.010988645
11 | 69,1,0.020108026
12 | 70,1,0.003012902
13 | 71,1,0.023422545
14 | 72,1,0.004124414
15 | 73,1,0.018006261
16 | 74,1,0.013104511
17 | 75,1,0.025255571
18 | 76,1,0.026031737
19 | 77,1,0.012071932
20 | 78,1,0.013005982
21 | 79,1,0.028466041
22 | 80,1,0.003391318
23 | 81,1,0.011968808
24 | 82,1,0.012816607
25 | 83,1,0.022359495
26 | 84,1,0.010859407
27 | 85,1,0.026315259
28 | 86,1,0.019319913
29 | 87,1,0.018977731
30 | 88,1,0.02033665
31 | 89,1,0.003011844
32 | 90,1,0.005254821
33 | 60,2,0.016832963
34 | 61,2,0.022643106
35 | 62,2,0.019134093
36 | 63,2,0.012305199
37 | 64,2,0.00218986
38 | 65,2,0.020048466
39 | 66,2,0.008035867
40 | 67,2,0.003641619
41 | 68,2,0.004069419
42 | 69,2,0.02847705
43 | 70,2,0.030920114
44 | 71,2,0.012431315
45 | 72,2,0.012116913
46 | 73,2,0.007329919
47 | 74,2,0.015104434
48 | 75,2,0.006863588
49 | 76,2,0.030033388
50 | 77,2,0.021438696
51 | 78,2,0.02237086
52 | 79,2,0.017010109
53 | 80,2,0.01540871
54 | 81,2,0.028309092
55 | 82,2,0.019318632
56 | 83,2,0.030142101
57 | 84,2,0.027644188
58 | 85,2,0.005828101
59 | 86,2,0.020199233
60 | 87,2,0.005647923
61 | 88,2,0.021849929
62 | 89,2,0.023390694
63 | 90,2,0.001278146
64 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/THR_options.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,100
8 | init,"1000, 0, 0, 0, 0"
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/THR_parameters.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa,.comment
2 | lngamma,0.3740968,0.2791966,0.468997,"normal(0.27, 0.001)",
3 | gamma,exp(lngamma),,,,
4 | constant,-5.490935,-5.906719,-5.075151,,
5 | agecoef,-0.0367022,-0.0471246,-0.0262798,"normal(-0.04, 0.001)",
6 | malecoef,0.768536,0.550404,0.986668,,
7 | np1,-1.344474,-2.109637,-0.579311,,
8 | rr,exp(np1),0.121282,0.5602843,"prop(0.12, 500)",
9 | age_init,60,,,,
10 | age,age_init + markov_cycle,,,,
11 | sex,0,,,,
12 | sex_str,"ifelse(sex==1, ""Males"", ""Females"")",,,,
13 | mr,"look_up(mr_table, age = age, sex = sex_str, bin = TRUE, value = ""value"")",,,,
14 | lambdaStandard,exp(constant + agecoef * age_init + malecoef * sex),,,,
15 | lambdaNew,exp(constant + agecoef * age_init + malecoef * sex) * rr,,,,
16 | pHRFailStandard,1 - exp(lambdaStandard * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
17 | pHRFailNew,1 - exp(lambdaNew * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
18 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/THR_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.015
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | new,PrimaryTHR,0,0,0.015
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/THR_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | standard,SuccessfulPrimary,Death,mr
7 | standard,RevisionTHR,SuccessfulRevision,C
8 | standard,RevisionTHR,Death,0.02+mr
9 | standard,SuccessfulRevision,SuccessfulRevision,C
10 | standard,SuccessfulRevision,RevisionTHR,0.04
11 | standard,SuccessfulRevision,Death,mr
12 | standard,Death,Death,1
13 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/input_dataframes/mr_table.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/test_no_overwrite/input_dataframes/mr_table.xlsx
--------------------------------------------------------------------------------
/inst/tabular/test/test_no_overwrite/output/state_count_plot_standard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/test_no_overwrite/output/state_count_plot_standard.png
--------------------------------------------------------------------------------
/inst/tabular/test/testing_CSV_file_with_comment_col.csv:
--------------------------------------------------------------------------------
1 | .model,state,cost,qaly,.discount.cost,.discount.qaly,.comment1, .comment - two,.comment THREE,valid.column
2 | standard,mystate1,0,qalyS1S,0.03,0.03,text of comment,yet another text,,a
3 | standard,mystaet2,0,qalyS2,,,another comment,,,b
4 | new,mystate1,12,qalyS1N,0.03,0.03,this has no comment,blank,,555
5 |
--------------------------------------------------------------------------------
/inst/tabular/test/testing_XLSX_file_with_comment_col.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/testing_XLSX_file_with_comment_col.xlsx
--------------------------------------------------------------------------------
/inst/tabular/test/testing_XLS_file_with_comment_col.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/testing_XLS_file_with_comment_col.xls
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/.gitignore:
--------------------------------------------------------------------------------
1 | output
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/REFERENCE.csv:
--------------------------------------------------------------------------------
1 | data,file,.comment,.comment2
2 | state,THR_states.csv,list of states and their costs and effects,
3 | state_trans,THR_state_trans.csv,,
4 | tm,THR_transition_probs.csv,transition probabilities,
5 | parameters,THR_parameters.csv,parameters of the models,
6 | demographics,THR_demographic_table.csv,demographic file,
7 | data,input_dataframes,folder that stores the dataframes to be input,input_dataframes
8 | output,output,folder to store outputs,
9 | options,THR_options.csv,model options,
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/REFERENCE_2core.csv:
--------------------------------------------------------------------------------
1 | data,file,.comment,.comment2
2 | state,THR_states.csv,list of states and their costs and effects,
3 | tm,THR_transition_probs.csv,transition probabilities,
4 | parameters,THR_parameters.csv,parameters of the models,
5 | demographics,THR_demographic_table.csv,demographic file,
6 | data,input_dataframes,folder that stores the dataframes to be input,input_dataframes
7 | output,output,folder to store outputs,
8 | options,THR_options_2core.csv,model options,
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_demographic_table.csv:
--------------------------------------------------------------------------------
1 | age_init,sex,.weights
2 | 82,1,0.012816607
3 | 83,1,0.022359495
4 | 84,1,0.010859407
5 | 60,2,0.016832963
6 | 61,2,0.022643106
7 | 62,2,0.019134093
8 | 63,2,0.012305199
9 | 64,2,0.00218986
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_options.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,10
8 | init,"1000, 0, 0, 0, 0"
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_options_2core.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,100
8 | num_cores,2
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_parameters.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa,.comment
2 | lngamma,0.3740968,0.2791966,0.468997,"normal(0.27, 0.001)",
3 | gamma,exp(lngamma),,,,
4 | constant,-5.490935,-5.906719,-5.075151,,
5 | agecoef,-0.0367022,-0.0471246,-0.0262798,"normal(-0.04, 0.001)",
6 | malecoef,0.768536,0.550404,0.986668,,
7 | np1,-1.344474,-2.109637,-0.579311,,
8 | rr,exp(np1),0.121282,0.5602843,"binomial(0.12, 500)",
9 | age_init,60,,,,
10 | age,age_init + markov_cycle,,,,
11 | sex,0,,,,
12 | sex_str,"ifelse(sex==1, ""Males"", ""Females"")",,,,
13 | mr,"look_up(mr_table, age = age, sex = sex_str, bin = TRUE, value = ""value"")",,,,
14 | lambdaStandard,exp(constant + agecoef * age_init + malecoef * sex),,,,
15 | lambdaNew,exp(constant + agecoef * age_init + malecoef * sex) * rr,,,,
16 | pHRFailStandard,1 - exp(lambdaStandard * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
17 | pHRFailNew,1 - exp(lambdaNew * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
18 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_state_trans.csv:
--------------------------------------------------------------------------------
1 | .model,.transition,from,to,cost,qaly,.discount.cost
2 | standard,Success,PrimaryTHR,SuccessfulPrimary,1000,0,0.015
3 | standard,Dying,,Death,10000,0,0.015
4 | new,Dying,,Death,10000,0,0.015
5 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.015
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | new,PrimaryTHR,0,0,0.015
8 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/THR_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | standard,SuccessfulPrimary,Death,mr
7 | standard,RevisionTHR,SuccessfulRevision,C
8 | standard,RevisionTHR,Death,0.02+mr
9 | standard,SuccessfulRevision,SuccessfulRevision,C
10 | standard,SuccessfulRevision,RevisionTHR,0.04
11 | standard,SuccessfulRevision,Death,mr
12 | standard,Death,Death,1
13 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
14 |
--------------------------------------------------------------------------------
/inst/tabular/test/thr_trans/input_dataframes/mr_table.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/test/thr_trans/input_dataframes/mr_table.xlsx
--------------------------------------------------------------------------------
/inst/tabular/test/toedit_REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "tm","THR_transition_probs.csv","transition probabilities",
4 | "parameters","THR_parameters.csv","parameters of the models",
5 | "demographics","THR_demographic_table.csv","demographic file",
6 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
7 | "output","output","folder to store outputs",
8 | "options","THR_options.csv","model options",
9 |
--------------------------------------------------------------------------------
/inst/tabular/test/wrong_ext.tab:
--------------------------------------------------------------------------------
1 | col1 col2
2 | 1 2
3 | 3 4
--------------------------------------------------------------------------------
/inst/tabular/thr/.gitignore:
--------------------------------------------------------------------------------
1 | output
--------------------------------------------------------------------------------
/inst/tabular/thr/REFERENCE.csv:
--------------------------------------------------------------------------------
1 | "data","file",".comment",".comment2"
2 | "state","THR_states.csv","list of states and their costs and effects",
3 | "tm","THR_transition_probs.csv","transition probabilities",
4 | "parameters","THR_parameters.csv","parameters of the models",
5 | "demographics","THR_demographic_table.csv","demographic file",
6 | "data","input_dataframes","folder that stores the dataframes to be input","input_dataframes"
7 | "output","output","folder to store outputs",
8 | "options","THR_options.csv","model options",
9 |
--------------------------------------------------------------------------------
/inst/tabular/thr/REFERENCE_2core.csv:
--------------------------------------------------------------------------------
1 | data,file,.comment,.comment2
2 | state,THR_states.csv,list of states and their costs and effects,
3 | tm,THR_transition_probs.csv,transition probabilities,
4 | parameters,THR_parameters.csv,parameters of the models,
5 | demographics,THR_demographic_table.csv,demographic file,
6 | data,input_dataframes,folder that stores the dataframes to be input,input_dataframes
7 | output,output,folder to store outputs,
8 | options,THR_options_2core.csv,model options,
9 |
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_demographic_table.csv:
--------------------------------------------------------------------------------
1 | age_init,sex,.weights
2 | 82,1,0.012816607
3 | 83,1,0.022359495
4 | 84,1,0.010859407
5 | 60,2,0.016832963
6 | 61,2,0.022643106
7 | 62,2,0.019134093
8 | 63,2,0.012305199
9 | 64,2,0.00218986
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_options.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,10
8 | init,"1000, 0, 0, 0, 0"
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_options_2core.csv:
--------------------------------------------------------------------------------
1 | option,value
2 | cost,cost
3 | effect,qaly
4 | ,
5 | method,end
6 | cycles,50
7 | n,100
8 | num_cores,2
9 |
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_parameters.csv:
--------------------------------------------------------------------------------
1 | parameter,value,low,high,psa,.comment
2 | lngamma,0.3740968,0.2791966,0.468997,"normal(0.27, 0.001)",
3 | gamma,exp(lngamma),,,,
4 | constant,-5.490935,-5.906719,-5.075151,,
5 | agecoef,-0.0367022,-0.0471246,-0.0262798,"normal(-0.04, 0.001)",
6 | malecoef,0.768536,0.550404,0.986668,,
7 | np1,-1.344474,-2.109637,-0.579311,,
8 | rr,exp(np1),0.121282,0.5602843,"binomial(0.12, 500)",
9 | age_init,60,,,,
10 | age,age_init + markov_cycle,,,,
11 | sex,0,,,,
12 | sex_str,"ifelse(sex==1, ""Males"", ""Females"")",,,,
13 | mr,"look_up(mr_table, age = age, sex = sex_str, bin = TRUE, value = ""value"")",,,,
14 | lambdaStandard,exp(constant + agecoef * age_init + malecoef * sex),,,,
15 | lambdaNew,exp(constant + agecoef * age_init + malecoef * sex) * rr,,,,
16 | pHRFailStandard,1 - exp(lambdaStandard * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
17 | pHRFailNew,1 - exp(lambdaNew * ((markov_cycle-1)^gamma - markov_cycle^gamma)),,,,
18 |
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_states.csv:
--------------------------------------------------------------------------------
1 | .model,.state,cost,qaly,.discount.qaly
2 | standard,PrimaryTHR,0,0,0.015
3 | standard,SuccessfulPrimary,0,0.85,
4 | standard,RevisionTHR,5294,0.3,
5 | standard,SuccessfulRevision,0,0.75,
6 | standard,Death,0,0,
7 | new,PrimaryTHR,0,0,0.015
8 |
--------------------------------------------------------------------------------
/inst/tabular/thr/THR_transition_probs.csv:
--------------------------------------------------------------------------------
1 | .model,from,to,prob
2 | standard,PrimaryTHR,SuccessfulPrimary,C
3 | standard,PrimaryTHR,Death,0.02
4 | standard,SuccessfulPrimary,SuccessfulPrimary,C
5 | standard,SuccessfulPrimary,RevisionTHR,pHRFailStandard
6 | standard,SuccessfulPrimary,Death,mr
7 | standard,RevisionTHR,SuccessfulRevision,C
8 | standard,RevisionTHR,Death,0.02+mr
9 | standard,SuccessfulRevision,SuccessfulRevision,C
10 | standard,SuccessfulRevision,RevisionTHR,0.04
11 | standard,SuccessfulRevision,Death,mr
12 | standard,Death,Death,1
13 | new,SuccessfulPrimary,RevisionTHR,pHRFailNew
14 |
--------------------------------------------------------------------------------
/inst/tabular/thr/input_dataframes/mr_table.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/inst/tabular/thr/input_dataframes/mr_table.xlsx
--------------------------------------------------------------------------------
/man/acceptability_curve.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/acceptability_curve.R
3 | \name{acceptability_curve}
4 | \alias{acceptability_curve}
5 | \title{Acceptability Curve from Probabilistic Analysis}
6 | \usage{
7 | acceptability_curve(x, wtp_thresholds)
8 | }
9 | \arguments{
10 | \item{x}{Result from \code{\link[=run_psa]{run_psa()}}.}
11 |
12 | \item{wtp_thresholds}{willingness to pay thresholds}
13 | }
14 | \value{
15 | A data frame with columns \code{.ceac} (the
16 | cost-effectiveness acceptability threshold),
17 | \code{.model} (treatments or models), \code{.n} (the
18 | number of cases in which the treatment was most
19 | cost-effective), and \code{.p} (the proportion of cases
20 | where the treatment was most effective).
21 | }
22 | \description{
23 | Acceptability Curve from Probabilistic Analysis
24 | }
25 | \section{Copyright}{
26 | 2016 Antoine Pierucci
27 | }
28 |
29 | \keyword{internal}
30 |
--------------------------------------------------------------------------------
/man/as_expr_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/expand.R
3 | \name{as_expr_list}
4 | \alias{as_expr_list}
5 | \title{Convert Lazy Dots to Expression List}
6 | \usage{
7 | as_expr_list(.dots)
8 | }
9 | \arguments{
10 | \item{.dots}{A lazy dots object.}
11 | }
12 | \value{
13 | A list of expression.
14 | }
15 | \description{
16 | This function is used by \code{\link[=interpolate]{interpolate()}}.
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/by_group.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dispatch_strategy.R
3 | \name{by_group}
4 | \alias{by_group}
5 | \title{Define a formula whose value is group-dependent}
6 | \usage{
7 | by_group(.group, ...)
8 | }
9 | \arguments{
10 | \item{.group}{Optional group name. If not specified
11 | it is implicitly added.}
12 |
13 | \item{...}{Values of the parameter named depending on the
14 | group}
15 | }
16 | \value{
17 | A vector of values.
18 | }
19 | \description{
20 | Returns different values depending on the group
21 | }
22 | \examples{
23 |
24 | define_parameters(
25 | val = 456,
26 | x = by_group(
27 | strat_1 = 1234,
28 | strat_2 = 9876,
29 | strat_3 = val * 2 + markov_cycle
30 | )
31 | )
32 | }
33 |
--------------------------------------------------------------------------------
/man/by_group_hack.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dispatch_strategy.R
3 | \name{by_group_hack}
4 | \alias{by_group_hack}
5 | \title{Hack to Automate Use of Group Name}
6 | \usage{
7 | by_group_hack(.dots)
8 | }
9 | \arguments{
10 | \item{.dots}{A \code{lazy_dots} object.}
11 | }
12 | \value{
13 | A modified \code{lazy_dots} object.
14 | }
15 | \description{
16 | This function is a hack to automate the definition of the
17 | argument \code{.group} in
18 | \code{\link[=by_group]{by_group()}}.
19 | }
20 | \details{
21 | The hack consists in replacing calls to
22 | \code{by_group(...)} by
23 | \code{by_group(.group = group, ...)} if
24 | \code{.group} is not already defined.
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/man/by_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dispatch_strategy.R
3 | \name{by_strategy}
4 | \alias{by_strategy}
5 | \title{Define a formula whose value is strategy-dependent}
6 | \usage{
7 | by_strategy(.strategy, ...)
8 | }
9 | \arguments{
10 | \item{.strategy}{Optional strategy name. If not specified
11 | it is implicitly added.}
12 |
13 | \item{...}{Values of the parameter named depending on the
14 | strategy.}
15 | }
16 | \value{
17 | A vector of values.
18 | }
19 | \description{
20 | Returns different values depending on the strategy.
21 | }
22 | \examples{
23 |
24 | define_parameters(
25 | val = 456,
26 | x = by_strategy(
27 | strat_1 = 1234,
28 | strat_2 = 9876,
29 | strat_3 = val * 2 + markov_cycle
30 | )
31 | )
32 | }
33 |
--------------------------------------------------------------------------------
/man/c_linear.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_eval.R
3 | \name{c_linear}
4 | \alias{c_linear}
5 | \title{Linearization of cost}
6 | \usage{
7 | c_linear(res_vbp, strategy)
8 | }
9 | \arguments{
10 | \item{res_vbp}{The result of a VBP analysis}
11 |
12 | \item{strategy}{Strategy}
13 | }
14 | \value{
15 | Intercept and slope of linearization, and indicator whether
16 | linearization was performed
17 | }
18 | \description{
19 | Calculates the linear equation of cost as a function of price per strategy
20 | }
21 |
--------------------------------------------------------------------------------
/man/ce_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_eval.R
3 | \name{ce_strategy}
4 | \alias{ce_strategy}
5 | \title{Cost and effectiveness per strategy}
6 | \usage{
7 | ce_strategy(model, strategy)
8 | }
9 | \arguments{
10 | \item{model}{A heRomod model}
11 |
12 | \item{strategy}{Strategy}
13 | }
14 | \value{
15 | Cost and effectivness for selected strategy
16 | }
17 | \description{
18 | Returns the cost and effectiveness for selected strategy
19 | }
20 |
--------------------------------------------------------------------------------
/man/check_matrix.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/matrix_eval.R
3 | \name{check_matrix}
4 | \alias{check_matrix}
5 | \title{Check Markov Model Transition Matrix}
6 | \usage{
7 | check_matrix(x)
8 | }
9 | \arguments{
10 | \item{x}{a matrix.}
11 | }
12 | \value{
13 | \code{NULL}
14 | }
15 | \description{
16 | Check whether a matrix fullfills the conditions to be a
17 | transition matrix.
18 | }
19 | \details{
20 | This function is called by \code{\link[=eval_transition]{eval_transition()}}
21 | and should not be used directly.
22 |
23 | Checks whether all rows sum to 1 and all probabilities
24 | are between 0 and 1.
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/man/check_names.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{check_names}
4 | \alias{check_names}
5 | \title{Check Names}
6 | \usage{
7 | check_names(x)
8 | }
9 | \arguments{
10 | \item{x}{A character vector of names.}
11 | }
12 | \value{
13 | Nothing, just throws an error if a reserved name
14 | is encountered.
15 | }
16 | \description{
17 | Throws an error if any of the names are reserved.
18 | }
19 | \details{
20 | Reserved names are \code{markov_cycle} and anything
21 | starting with \code{.}.
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/man/check_states.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{check_states}
4 | \alias{check_states}
5 | \title{Check Model States for Consistency}
6 | \usage{
7 | check_states(x)
8 | }
9 | \arguments{
10 | \item{x}{An object of class \code{uneval_states}.}
11 | }
12 | \value{
13 | \code{NULL}
14 | }
15 | \description{
16 | For internal use.
17 | }
18 | \details{
19 | All states should have the same value names.
20 | }
21 | \keyword{internal}
22 |
--------------------------------------------------------------------------------
/man/check_strategy_index.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{check_strategy_index}
4 | \alias{check_strategy_index}
5 | \title{Check Strategy Index}
6 | \usage{
7 | check_strategy_index(x, i, allow_multiple = FALSE)
8 | }
9 | \arguments{
10 | \item{x}{A result from \code{\link[=run_model]{run_model()}}.}
11 |
12 | \item{i}{A strategy index, character or numeric.}
13 |
14 | \item{allow_multiple}{logical. Allow multiple strategy
15 | index?}
16 | }
17 | \value{
18 | Strategy names.
19 | }
20 | \description{
21 | Check Strategy Index
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/man/clean_factors.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{clean_factors}
4 | \alias{clean_factors}
5 | \title{Convert Data Frame Factor Variables to Character}
6 | \usage{
7 | clean_factors(x)
8 | }
9 | \arguments{
10 | \item{x}{A data frame.}
11 | }
12 | \value{
13 | A data frame.
14 | }
15 | \description{
16 | Convert Data Frame Factor Variables to Character
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/cluster.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/cluster.R
3 | \name{cluster}
4 | \alias{cluster}
5 | \alias{use_cluster}
6 | \alias{status_cluster}
7 | \alias{close_cluster}
8 | \title{Run \code{heRomod} on a Cluster}
9 | \usage{
10 | use_cluster(num_cores, cluster = NULL, close = TRUE)
11 |
12 | status_cluster(verbose = TRUE)
13 |
14 | close_cluster()
15 | }
16 | \arguments{
17 | \item{num_cores}{Number of core.}
18 |
19 | \item{cluster}{A custom cluster. See details.}
20 |
21 | \item{close}{Close existing cluster before defining a new
22 | one?}
23 |
24 | \item{verbose}{Print cluster info.}
25 | }
26 | \value{
27 | \code{use_cluster} and \code{close_cluster}
28 | return \code{TRUE} invisibly in case of success.
29 | \code{status_cluster} returns \code{TRUE} if a cluster
30 | is defined, \code{FALSE} otherwise.
31 | }
32 | \description{
33 | These functions create or delete a cluster for
34 | \code{heRomod}. When the cluster is created it is
35 | automagically used by \code{heRomod} functions.
36 | }
37 | \details{
38 | The usual wokflow is to create the cluster with
39 | \code{use_cluster}, then run functions such as
40 | \code{\link[=run_psa]{run_psa()}} that make use of the cluster. To
41 | stop using the cluster run \code{\link[=close_cluster]{close_cluster()}}.
42 |
43 | The cluster status is given by \code{status_cluster}.
44 |
45 | A custom cluster can be passed to \code{use_cluster} with
46 | the \code{cluster} argument. This custom custer needs to
47 | work with \code{\link[parallel:clusterApply]{parallel::parLapply()}}.
48 | }
49 |
--------------------------------------------------------------------------------
/man/combine_models.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/combine.R
3 | \name{combine_models}
4 | \alias{combine_models}
5 | \title{Combine Multiple Models}
6 | \usage{
7 | combine_models(newmodels, weights, oldmodel)
8 | }
9 | \arguments{
10 | \item{newmodels}{A list of models run over a set of
11 | multiple parameters.}
12 |
13 | \item{weights}{A vector of weigths, same length as the
14 | number of parameter sets.}
15 |
16 | \item{oldmodel}{The original model.}
17 | }
18 | \value{
19 | A \code{combined_models} object, mostly similar
20 | to a result from \code{\link[=run_model]{run_model()}}. \code{plot}
21 | and \code{summary} methods are available.
22 | }
23 | \description{
24 | Given a set of models run with different parameters,
25 | return aggregated results to estimate population-level
26 | values.
27 | }
28 | \keyword{internal}
29 |
--------------------------------------------------------------------------------
/man/combine_probs.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/transform.R
3 | \name{combine_probs}
4 | \alias{combine_probs}
5 | \title{Combine Probabilities}
6 | \usage{
7 | combine_probs(...)
8 | }
9 | \arguments{
10 | \item{...}{Probability vectors.}
11 | }
12 | \value{
13 | A probability vector.
14 | }
15 | \description{
16 | Given several independent probabilities of an event,
17 | return the final probability of the event.
18 | }
19 | \details{
20 | This function is only correct if the probabilities are
21 | independent!
22 | }
23 | \examples{
24 |
25 | (p1 <- runif(5))
26 | (p2 <- runif(5))
27 | combine_probs(p1, p2)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/compute_counts.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_eval.R
3 | \name{compute_counts}
4 | \alias{compute_counts}
5 | \title{Compute Count of Individual in Each State per Cycle}
6 | \usage{
7 | compute_counts(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{An \code{eval_matrix} or
11 | \code{eval_part_surv} object.}
12 |
13 | \item{init}{numeric vector, same length as number of
14 | model states. Number of individuals in each model state
15 | at the beginning.}
16 |
17 | \item{inflow}{numeric vector, similar to \code{init}.
18 | Number of new individuals in each state per cycle.}
19 | }
20 | \value{
21 | A \code{cycle_counts} object.
22 | }
23 | \description{
24 | Given an initial number of individual and an evaluated
25 | transition matrix, returns the number of individual per
26 | state per cycle.
27 | }
28 | \details{
29 | Use the \code{method} argument to specify if transitions
30 | are supposed to happen at the beginning or the end of
31 | each cycle. Alternatively linear interpolation between
32 | cycles can be performed.
33 | }
34 | \keyword{internal}
35 |
--------------------------------------------------------------------------------
/man/compute_evppi.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/evppi_eval.R
3 | \name{compute_evppi}
4 | \alias{compute_evppi}
5 | \title{Compute Expected Value of partial Perfect Information (EVPPI)}
6 | \usage{
7 | compute_evppi(x, evppi, max_wtp = 1e+05, n = 10, verbose = TRUE)
8 | }
9 | \arguments{
10 | \item{x}{Result from \code{\link[=run_psa]{run_psa()}}.}
11 |
12 | \item{evppi}{An object returned by
13 | \code{\link[=define_evppi]{define_evppi()}}.}
14 |
15 | \item{max_wtp}{Maximal willingness to pay.}
16 |
17 | \item{n}{Number of WTP thresholds to estimate EVPPI (values above
18 | 10 may take significant time).}
19 |
20 | \item{verbose}{Logical variable indicating whether to display the progress
21 | of EVPPI calculations}
22 | }
23 | \value{
24 | A \code{data.frame} with one row per WTP threshold
25 | }
26 | \description{
27 | Compute EVPPI using a linear regression metamodeling approach.
28 | }
29 | \references{
30 | \enumerate{
31 | \item Jalal H, Alarid-Escudero F. A Gaussian Approximation Approach for Value of Information Analysis. Med Decis Making 2018; 38(2): 174-188.
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/man/compute_icer.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run_model_summary.R
3 | \name{compute_icer}
4 | \alias{compute_icer}
5 | \title{Compute ICER}
6 | \usage{
7 | compute_icer(x, strategy_order = order(x$.effect), threshold = 30000)
8 | }
9 | \arguments{
10 | \item{x}{Result of \code{\link[=run_model]{run_model()}}.}
11 |
12 | \item{strategy_order}{Order in which the strategies
13 | should be sorted. Default: by increasing effect.}
14 |
15 | \item{threshold}{ICER threshold for net monetary benefit
16 | computation.}
17 | }
18 | \value{
19 | A \code{data.frame} with computed ICER.
20 | }
21 | \description{
22 | Compute ICER for Markov models.
23 | }
24 | \details{
25 | Models are ordered by effectiveness and ICER are computed
26 | sequentially.
27 | }
28 | \keyword{internal}
29 |
--------------------------------------------------------------------------------
/man/compute_values.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_eval.R
3 | \name{compute_values}
4 | \alias{compute_values}
5 | \title{Compute State Values per Cycle}
6 | \usage{
7 | compute_values(states, counts, init, inflow, starting)
8 | }
9 | \arguments{
10 | \item{states}{An object of class \code{eval_state_list}.}
11 |
12 | \item{counts}{An object of class \code{cycle_counts}.}
13 | }
14 | \value{
15 | A data.frame of state values, one column per
16 | state value and one row per cycle.
17 | }
18 | \description{
19 | Given states and counts, computes the total state values
20 | per cycle.
21 | }
22 | \keyword{internal}
23 |
--------------------------------------------------------------------------------
/man/create_demographic_table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_demographic_table}
4 | \alias{create_demographic_table}
5 | \title{Read a Demographic Table}
6 | \usage{
7 | create_demographic_table(newdata, params)
8 | }
9 | \arguments{
10 | \item{newdata}{A data frame.}
11 |
12 | \item{params}{Parameters of a model, to check that all
13 | the columns in the demographic table (other than the
14 | weight column) are in the model.}
15 |
16 | \item{...}{catches other, unwanted arguments.}
17 | }
18 | \value{
19 | A data frame.
20 | }
21 | \description{
22 | This function mostly checks whether the parameters are
23 | correct.
24 | }
25 | \details{
26 | An optional \code{.weights} column can exist in the file.
27 | }
28 | \keyword{internal}
29 |
--------------------------------------------------------------------------------
/man/create_df_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_df_from_tabular}
4 | \alias{create_df_from_tabular}
5 | \title{Load Data From a Folder Into an Environment}
6 | \usage{
7 | create_df_from_tabular(df_dir, df_envir)
8 | }
9 | \arguments{
10 | \item{df_dir}{A directory containing the files.}
11 |
12 | \item{df_envir}{An environment.}
13 | }
14 | \value{
15 | The environment with the data frames.
16 | }
17 | \description{
18 | Reads files containing data frames (in tabular format)
19 | from a directory, and loads them in an environment to be
20 | available during an analysis.
21 | }
22 | \details{
23 | The files must be in .csv, .xls, or .xlsx format. A file
24 | my_df.csv (or my_df.xls, or my_df.xlsx) will be loaded as
25 | a data frame my_df.
26 | }
27 | \keyword{internal}
28 |
--------------------------------------------------------------------------------
/man/create_matrix_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_matrix_from_tabular}
4 | \alias{create_matrix_from_tabular}
5 | \title{Create a Transition Matrix From Tabular Input}
6 | \usage{
7 | create_matrix_from_tabular(trans_probs, state_names, df_env = globalenv())
8 | }
9 | \arguments{
10 | \item{trans_probs}{Result for one model of
11 | \code{\link[=parse_multi_spec]{parse_multi_spec()}}.}
12 |
13 | \item{state_names}{The names of the states used in the
14 | transition matrix.}
15 |
16 | \item{df_env}{An environment containing external data.}
17 | }
18 | \value{
19 | A transition matrix.
20 | }
21 | \description{
22 | Transforms tabular input defining a transition matrix
23 | into an \code{heRomod} object.
24 | }
25 | \details{
26 | The data frame \code{trans_probs} should have columns
27 | \code{from}, \code{to}, and \code{prob}, where
28 | \code{prob} is the probability of a transition from the
29 | \code{from} state to the \code{to} state. Prob can be
30 | defined in terms of parameters, just as when using
31 | \code{define_transition} at the keyboard. Probabilities of 0
32 | need not be specified - they will be automatically
33 | inserted.
34 |
35 | All state names must be used in the \code{from} column of
36 | the transition matrix (otherwise you can just get rid of
37 | the state). Absorbing states should have a transition
38 | from and to themselves with probability 1.
39 | }
40 | \keyword{internal}
41 |
--------------------------------------------------------------------------------
/man/create_model_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_model_from_tabular}
4 | \alias{create_model_from_tabular}
5 | \title{Create a \code{heRomod} Model From Tabular Files Info}
6 | \usage{
7 | create_model_from_tabular(
8 | state_info,
9 | tm_info,
10 | df_env = globalenv(),
11 | state_trans_info = NULL,
12 | start_info = NULL
13 | )
14 | }
15 | \arguments{
16 | \item{state_info}{A state tabular file (file path or
17 | parsed file).}
18 |
19 | \item{tm_info}{A transition matrix tabular file (file
20 | path or parsed file).}
21 |
22 | \item{df_env}{An environment containing external data.}
23 | }
24 | \value{
25 | A \code{heRomod} model as returned by
26 | \code{\link[=define_strategy]{define_strategy()}}.
27 | }
28 | \description{
29 | Calls \code{\link[=create_states_from_tabular]{create_states_from_tabular()}} and
30 | \code{\link[=create_matrix_from_tabular]{create_matrix_from_tabular()}}.
31 | }
32 | \keyword{internal}
33 |
--------------------------------------------------------------------------------
/man/create_model_list_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_model_list_from_tabular}
4 | \alias{create_model_list_from_tabular}
5 | \title{Read Models Specified by Files}
6 | \usage{
7 | create_model_list_from_tabular(ref, df_env = globalenv())
8 | }
9 | \arguments{
10 | \item{ref}{Imported reference file.}
11 |
12 | \item{df_env}{An environment containing external data.}
13 | }
14 | \value{
15 | A list of unevaluated models.
16 | }
17 | \description{
18 | Read Models Specified by Files
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/create_options_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_options_from_tabular}
4 | \alias{create_options_from_tabular}
5 | \title{Create Model Options From a Tabular Input}
6 | \usage{
7 | create_options_from_tabular(opt, state_names, df_env = globalenv())
8 | }
9 | \arguments{
10 | \item{opt}{An option data frame.}
11 | }
12 | \value{
13 | A list of model options.
14 | }
15 | \description{
16 | Create Model Options From a Tabular Input
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/create_parameters_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_parameters_from_tabular}
4 | \alias{create_parameters_from_tabular}
5 | \title{Create a Parameter Definition From Tabular Input}
6 | \usage{
7 | create_parameters_from_tabular(
8 | param_defs,
9 | df_env = globalenv(),
10 | psa_options = NULL
11 | )
12 | }
13 | \arguments{
14 | \item{param_defs}{A parameter definition file.}
15 |
16 | \item{df_env}{An environment containing external data.}
17 | }
18 | \value{
19 | The parameter definition.
20 | }
21 | \description{
22 | If specified in the tabular file, DSA and PSA can also be
23 | created.
24 | }
25 | \details{
26 | The tabular parameter definition file can have the
27 | following columns: \code{parameter} (the parameter name,
28 | required), \code{value} (required), \code{low} and
29 | \code{high} (if both are present, a deterministic
30 | sensitivity analysis will be performed), and \code{psa}
31 | (a definition of a distribution to use in a probabilistic
32 | sensitivity analysis. Other columns will be ignored.
33 | }
34 | \keyword{internal}
35 |
--------------------------------------------------------------------------------
/man/create_states_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{create_states_from_tabular}
4 | \alias{create_states_from_tabular}
5 | \title{Create State Definitions From Tabular Input}
6 | \usage{
7 | create_states_from_tabular(
8 | state_info,
9 | df_env = globalenv(),
10 | state_trans_info = NULL
11 | )
12 | }
13 | \arguments{
14 | \item{state_info}{Result for one model of
15 | \code{\link[=parse_multi_spec]{parse_multi_spec()}}.}
16 |
17 | \item{df_env}{An environment containing external data.}
18 |
19 | \item{state_trans_info}{Optional result for one model of
20 | \code{\link[=parse_multi_spec]{parse_multi_spec()}} with state transitions.}
21 | }
22 | \value{
23 | A state list.
24 | }
25 | \description{
26 | Transforms tabular input defining states into an
27 | \code{heRomod} object.
28 | }
29 | \details{
30 | Columns of state_info besides .model and state include
31 | costs and utilities we want to keep track of, with
32 | appropriate values (these may include parameters). For
33 | any cost or utility that should be discounted, an
34 | additional column with the name ".discount.\if{html}{\out{}}" or
35 | ".discount.\if{html}{\out{}}", for the appropriate cost or effect,
36 | can be included. If no discounting is desired for a
37 | particular cost or effect, the corresponding column can
38 | be omitted.
39 |
40 | A discount column can contain only a single value - a
41 | cost or benefit must be discounted by the same amount in
42 | each state. Discounts can be numbers or parameters (which
43 | will then need to be defined like any other).
44 |
45 | The input data frame is expected to contain state
46 | information for all the models you will use in an
47 | analysis. For more information see the vignette:
48 | \code{vignette("file-input", package = "heRomod")}.
49 | }
50 | \keyword{internal}
51 |
--------------------------------------------------------------------------------
/man/define_calibration_fn.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/calibration.R
3 | \name{define_calibration_fn}
4 | \alias{define_calibration_fn}
5 | \title{Define Calibration Function}
6 | \usage{
7 | define_calibration_fn(
8 | type,
9 | strategy_names,
10 | element_names,
11 | cycles,
12 | groups = NULL,
13 | aggreg_fn = sum
14 | )
15 | }
16 | \arguments{
17 | \item{type}{Type of model values (\code{count} or \code{value}).}
18 |
19 | \item{strategy_names}{Names of strategies.}
20 |
21 | \item{element_names}{Names of states (for counts) or of
22 | state values (for values).}
23 |
24 | \item{cycles}{Cycles of interest.}
25 |
26 | \item{groups}{Optional grouping of values (values in a
27 | same group have the same \code{groups}).}
28 |
29 | \item{aggreg_fn}{A function to aggregate values in a same
30 | group.}
31 | }
32 | \value{
33 | A numeric vector.
34 | }
35 | \description{
36 | Define a function to be passed to the \code{fn_values}
37 | argument of \code{\link[=calibrate_model]{calibrate_model()}}.
38 | }
39 | \examples{
40 | example("run_model")
41 |
42 | f <- define_calibration_fn(
43 | type = c("count", "count", "value"),
44 | strategy_names = c("I", "I", "II"),
45 | element_names = c("A", "B", "ly"),
46 | cycles = c(3, 5, 9),
47 | groups = c(1, 1, 2),
48 | aggreg_fn = mean
49 | )
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/man/define_correlation.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/resamp_define.R
3 | \name{define_correlation}
4 | \alias{define_correlation}
5 | \alias{define_correlation_}
6 | \title{Define a Correlation Structure for Probabilistic
7 | Uncertainty Analysis}
8 | \usage{
9 | define_correlation(...)
10 |
11 | define_correlation_(.dots)
12 | }
13 | \arguments{
14 | \item{...}{A list of parameter names and correlation
15 | coeficients of the form \code{var1, var2, cor(var1,
16 | var2), var3, var4, cor(var3, var4), ...}.}
17 |
18 | \item{.dots}{Used to work around non-standard evaluation.}
19 | }
20 | \value{
21 | An object of class \code{correlation_matrix}.
22 | }
23 | \description{
24 | Not all correlation need to be specified for all variable
25 | combinations, unspecified correlations are assumed to be
26 | 0.
27 | }
28 | \examples{
29 |
30 | cm <- define_correlation(
31 | var1, var2, .4,
32 | var1, var3, -.2,
33 | var2, var3, .1
34 | )
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/man/define_dsa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sensitivity_define.R
3 | \name{define_dsa}
4 | \alias{define_dsa}
5 | \alias{define_dsa_}
6 | \title{Define a Sensitivity Analysis}
7 | \usage{
8 | define_dsa(...)
9 |
10 | define_dsa_(par_names, low_dots, high_dots)
11 | }
12 | \arguments{
13 | \item{...}{A list of parameter names and min/max values
14 | of the form \code{var1, min(var1), max(var1), var2,
15 | min(var2), max(var2), ...}.}
16 |
17 | \item{par_names}{String vector of parameter names.}
18 |
19 | \item{low_dots, high_dots}{Used to work around
20 | non-standard evaluation.}
21 | }
22 | \value{
23 | A \code{sensitivity} object.
24 | }
25 | \description{
26 | Define parameter variations for a Markov model
27 | sensitivity analysis.
28 | }
29 | \examples{
30 |
31 | define_dsa(
32 | a, 10, 45,
33 | b, .5, 1.5
34 | )
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/man/define_evppi.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/evppi_define.R
3 | \name{define_evppi}
4 | \alias{define_evppi}
5 | \alias{define_evppi_}
6 | \title{Define an Expected Value of Partial Perfect Information (EVPPI) Analysis}
7 | \usage{
8 | define_evppi(...)
9 |
10 | define_evppi_(par_names)
11 | }
12 | \arguments{
13 | \item{par_names}{String of parameter name or names}
14 | }
15 | \value{
16 | An \code{evppi} object.
17 | }
18 | \description{
19 | Define the parameter for EVPPI analysis of Markov models using a
20 | linear regression metmodeling approach
21 | }
22 | \details{
23 | The parameter name should be a string
24 | }
25 | \examples{
26 | evppi.p1 <- define_evppi(
27 | prob1
28 | )
29 | evppi.p1
30 | }
31 | \references{
32 | \enumerate{
33 | \item Jalal H, Alarid-Escudero F. A Gaussian Approximation Approach for Value of Information Analysis. Med Decis Making 2018; 38(2): 174-188.
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/man/define_inflow.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_define.R
3 | \name{define_inflow}
4 | \alias{define_inflow}
5 | \alias{define_inflow_}
6 | \title{Define Inflow for a BIA}
7 | \usage{
8 | define_inflow(...)
9 |
10 | define_inflow_(.dots)
11 | }
12 | \arguments{
13 | \item{...}{Name-value pairs of expressions defining
14 | inflow counts.}
15 |
16 | \item{.dots}{Used to work around non-standard evaluation.}
17 | }
18 | \value{
19 | An object similar to the return value of
20 | \code{\link[=define_parameters]{define_parameters()}}.
21 | }
22 | \description{
23 | Define Inflow for a BIA
24 | }
25 |
--------------------------------------------------------------------------------
/man/define_init.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_define.R
3 | \name{define_init}
4 | \alias{define_init}
5 | \alias{define_init_}
6 | \title{Define Initial Counts}
7 | \usage{
8 | define_init(...)
9 |
10 | define_init_(.dots)
11 | }
12 | \arguments{
13 | \item{...}{Name-value pairs of expressions defining
14 | initial counts.}
15 |
16 | \item{.dots}{Used to work around non-standard evaluation.}
17 | }
18 | \value{
19 | An object similar to the return value of
20 | \code{\link[=define_parameters]{define_parameters()}}.
21 | }
22 | \description{
23 | Define Initial Counts
24 | }
25 |
--------------------------------------------------------------------------------
/man/define_part_surv.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/part_surv.R
3 | \name{define_part_surv}
4 | \alias{define_part_surv}
5 | \alias{define_part_surv_}
6 | \title{Define Partitioned Survival}
7 | \usage{
8 | define_part_surv(
9 | pfs,
10 | os,
11 | state_names,
12 | terminal_state = FALSE,
13 | cycle_length = 1
14 | )
15 |
16 | define_part_surv_(pfs, os, state_names, cycle_length = 1)
17 | }
18 | \arguments{
19 | \item{pfs, os}{Either results from
20 | \code{\link[flexsurv:flexsurvreg]{flexsurv::flexsurvreg()}} or
21 | \code{\link[=define_survival]{define_survival()}}.}
22 |
23 | \item{state_names}{named character vector, length 3 or 4.
24 | State names for progression-free state, progression,
25 | (optionally terminal) and death respectively. Elements
26 | should be named \code{"progression_free"},
27 | \code{"progression"}, (optionally \code{"terminal"}),
28 | and \code{"death"}. See examples.}
29 |
30 | \item{terminal_state}{Should a terminal state be
31 | included? Only used when state names are not provided.}
32 |
33 | \item{cycle_length}{The value of a Markov cycle in
34 | absolute time units.}
35 | }
36 | \value{
37 | A \code{part_surv} object.
38 | }
39 | \description{
40 | Define a partitioned survival model with progression-free
41 | survival and overall survival.
42 | }
43 | \examples{
44 | dist_pfs <- define_survival("exp", rate = 1)
45 | dist_os <- define_survival("exp", rate = .5)
46 |
47 | define_part_surv(
48 | pfs = dist_pfs,
49 | os = dist_os,
50 | state_names = c(
51 | progression_free = "A",
52 | progression = "B",
53 | terminal = "C",
54 | death = "D"
55 | )
56 | )
57 | # identical to:
58 | define_part_surv(
59 | pfs = dist_pfs,
60 | os = dist_os,
61 | terminal_state = TRUE
62 | )
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/man/define_part_surv_custom.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/part_surv.R
3 | \name{define_part_surv_custom}
4 | \alias{define_part_surv_custom}
5 | \title{Convert saved fits to partitioned survival objects}
6 | \usage{
7 | define_part_surv_custom(...)
8 | }
9 | \arguments{
10 | \item{surv_inputs}{a list of matrices of \code{flexsurvreg} objects,
11 | for example the first element of the output of \code{survival_from_data}.}
12 |
13 | \item{state_names}{names of states of the model}
14 | }
15 | \description{
16 | Convert saved fits to partitioned survival objects
17 | }
18 | \details{
19 | surv_inputs is a tibble with columns
20 | type (PFS or OS, not case sensitive), treatment,
21 | set_name (for data subsets),
22 | dist (for survival distribution assumptions),
23 | fit (for the fitted survival object) and set_def
24 | (how the subset of data was defined, just to keep it around)
25 | }
26 |
--------------------------------------------------------------------------------
/man/define_psa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/resamp_define.R
3 | \name{define_psa}
4 | \alias{define_psa}
5 | \alias{define_psa_}
6 | \title{Define Parameters Distribution for Probabilistic Analysis}
7 | \usage{
8 | define_psa(..., correlation)
9 |
10 | define_psa_(.dots = list(), correlation)
11 | }
12 | \arguments{
13 | \item{...}{Formulas defining parameter distributions.}
14 |
15 | \item{correlation}{A correlation matrix for parameters or
16 | the output of \code{\link[=define_correlation]{define_correlation()}}.}
17 |
18 | \item{.dots}{Pair/values of expressions coercible to lazy objects.}
19 | }
20 | \value{
21 | An object of class \code{resamp_definition}.
22 | Contains \code{list_qdist}, a list of quantile
23 | functions and \code{correlation} a correlation matrix.
24 | }
25 | \description{
26 | Define the properties of parameter distributions and
27 | their correlation structure for probabilistic uncertainty
28 | analysis of Markov models.
29 | }
30 | \details{
31 | The distributions must be defined within \code{heRomod}
32 | (see \link{distributions}), or defined with
33 | \code{\link[=define_distribution]{define_distribution()}}.
34 |
35 | If no correlation matrix is specified parameters are
36 | assumed to be independant.
37 |
38 | The correlation patrix need only be specified for
39 | correlated parameters.
40 | }
41 | \examples{
42 | mc <- define_correlation(
43 | age_init, cost_init, .4
44 | )
45 |
46 | define_psa(
47 | age_init ~ normal(60, 10),
48 | cost_init ~ normal(1000, 100),
49 | correlation = mc
50 | )
51 |
52 | # example with multinomial parameters
53 |
54 | define_psa(
55 | rate1 + rate2 + rate3 ~ multinomial(10, 50, 40),
56 | a + b ~ multinomial(15, 30)
57 | )
58 | }
59 |
--------------------------------------------------------------------------------
/man/define_starting_values.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_define.R
3 | \name{define_starting_values}
4 | \alias{define_starting_values}
5 | \alias{define_starting_values_}
6 | \title{Define Starting State Values}
7 | \usage{
8 | define_starting_values(...)
9 |
10 | define_starting_values_(.dots)
11 | }
12 | \arguments{
13 | \item{...}{Name-value pairs of expressions defining
14 | starting values.}
15 |
16 | \item{.dots}{Used to work around non-standard evaluation.}
17 | }
18 | \value{
19 | An object similar to the return value of
20 | \code{\link[=define_parameters]{define_parameters()}}.
21 | }
22 | \description{
23 | Define Starting State Values
24 | }
25 |
--------------------------------------------------------------------------------
/man/define_state.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{define_state}
4 | \alias{define_state}
5 | \alias{define_state_}
6 | \alias{modify.state}
7 | \title{Define a Markov Model State}
8 | \usage{
9 | define_state(...)
10 |
11 | define_state_(.dots)
12 |
13 | \method{modify}{state}(.OBJECT, ...)
14 | }
15 | \arguments{
16 | \item{...}{Name-value pairs of expressions defining state
17 | values.}
18 |
19 | \item{.dots}{Used to work around non-standard evaluation.}
20 |
21 | \item{.OBJECT}{An object of class \code{state}.}
22 | }
23 | \value{
24 | An object of class \code{state} (actually a named
25 | list of \code{lazy} expressions).
26 | }
27 | \description{
28 | Define the values characterising a Markov Model state for
29 | 1 cycle.
30 | }
31 | \details{
32 | As with \code{\link[=define_parameters]{define_parameters()}}, state values are
33 | defined sequentially. Later state definition can thus
34 | only refer to values defined earlier.
35 |
36 | For the \code{modify} function, existing values are
37 | modified, no new values can be added. Values order
38 | matters since only values defined earlier can be
39 | referenced in later expressions.
40 | }
41 | \examples{
42 | st <- define_state(
43 | cost = 6453,
44 | utility = .876
45 | )
46 | st
47 | }
48 |
--------------------------------------------------------------------------------
/man/define_state_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{define_state_list}
4 | \alias{define_state_list}
5 | \alias{define_state_list_}
6 | \alias{modify.uneval_state_list}
7 | \alias{modify.uneval_state_transition_list}
8 | \title{Define Markov Model State List}
9 | \usage{
10 | define_state_list(...)
11 |
12 | define_state_list_(.dots)
13 |
14 | \method{modify}{uneval_state_list}(.OBJECT, ...)
15 |
16 | \method{modify}{uneval_state_transition_list}(.OBJECT, ...)
17 | }
18 | \arguments{
19 | \item{...}{Name-value pairs of expressions defining model
20 | states and state transtiions.}
21 |
22 | \item{.dots}{List of states, only used by
23 | \code{define_state_list_} to avoid using \code{...}.}
24 |
25 | \item{.OBJECT}{An \code{uneval_states} object.}
26 | }
27 | \value{
28 | An object of class \code{uneval_state_list} (a
29 | list of \code{state} objects).
30 | }
31 | \description{
32 | Define the states of a Markov model by combining
33 | \code{state} and \code{state_transition} objects.
34 | }
35 | \details{
36 | State names have to correspond to those specified through
37 | \code{\link[=define_transition]{define_transition()}}. State transitions do not need to
38 | be named.
39 |
40 | All states should have the same value names.
41 |
42 | The \code{modify} function can modify existing states and state
43 | transitions or add new ones.
44 | }
45 | \examples{
46 | \dontrun{
47 | s1 <- define_state(cost = 1, util = 1)
48 | s2 <- define_state(cost = 3, util = .4)
49 |
50 | states_mod <- define_state_list(
51 | healthy = s1,
52 | sick = s2
53 | )
54 |
55 | states_mod
56 |
57 | s1_bis <- define_state(cost = 0, util = 1)
58 | s3 <- define_state(cost = 10, util = .1)
59 |
60 | modify(
61 | states_mod,
62 | healthy = s1_bis,
63 | sicker = s3
64 | )
65 | }
66 |
67 | }
68 | \keyword{internal}
69 |
--------------------------------------------------------------------------------
/man/define_state_transition.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{define_state_transition}
4 | \alias{define_state_transition}
5 | \alias{define_state_transition_}
6 | \alias{modify.state_transition}
7 | \title{Define a Markov Model State Transition}
8 | \usage{
9 | define_state_transition(from = NA, to = NA, ...)
10 |
11 | define_state_transition_(to, from, .dots)
12 |
13 | \method{modify}{state_transition}(.OBJECT, ...)
14 |
15 | \method{modify}{state_transition}(.OBJECT, ...)
16 | }
17 | \arguments{
18 | \item{from}{Character vector of names of from-states for which
19 | value is applied. When not given, value is applied to any from
20 | state.}
21 |
22 | \item{to}{Character vector of names of to-states for which
23 | value is applied. When not given, value is applied to any to
24 | state.}
25 |
26 | \item{...}{Name-value pairs of expressions defining state
27 | values.}
28 |
29 | \item{.dots}{Used to work around non-standard evaluation.}
30 |
31 | \item{.OBJECT}{An object of class \code{state_transition}.}
32 | }
33 | \value{
34 | An object of class \code{state_transition} (actually a named
35 | list of \code{lazy} expressions).
36 | }
37 | \description{
38 | Define the values characterising a Markov Model trasition into,
39 | out of, or between states.
40 | }
41 | \details{
42 | As with \code{\link[=define_parameters]{define_parameters()}}, state transition values are
43 | defined sequentially. Later state definition can thus
44 | only refer to values defined earlier.
45 |
46 | For the \code{modify} function, existing values are
47 | modified, no new values can be added. Values order
48 | matters since only values defined earlier can be
49 | referenced in later expressions.
50 | }
51 |
--------------------------------------------------------------------------------
/man/define_state_transition_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{define_state_transition_list}
4 | \alias{define_state_transition_list}
5 | \alias{define_state_transition_list_}
6 | \title{Define Markov Model State Transition List}
7 | \usage{
8 | define_state_transition_list(...)
9 |
10 | define_state_transition_list_(.dots)
11 | }
12 | \arguments{
13 | \item{...}{expressions defining model state transtiions.}
14 |
15 | \item{.dots}{List of states, only used by
16 | \code{define_state_list_} to avoid using \code{...}.}
17 |
18 | \item{.OBJECT}{An \code{uneval_state_transition_list} object.}
19 | }
20 | \value{
21 | An object of class \code{uneval_state_list} (a
22 | list of \code{state} objects).
23 | }
24 | \description{
25 | Define the state transitions of a Markov model by combining
26 | \code{state_transition} objects.
27 | }
28 | \details{
29 | All states transitions should have the same value names
30 | as model states.
31 |
32 | The \code{modify} function can modify existing state
33 | transitions or add new ones.
34 | }
35 | \examples{
36 | \dontrun{
37 | s1 <- define_state_transition(from = "A", cost = 1, util = 1)
38 | s2 <- define_state_transition(from = "B", cost = 3, util = .4)
39 |
40 | states_trans_mod <- define_state_transition_list(
41 | s1,
42 | s2
43 | )
44 |
45 | states_mod
46 |
47 | s1_bis <- define_state_transition_list(from = "A", cost = 0, util = 1)
48 | s3 <- define_state(to = "A", cost = 10, util = .1)
49 |
50 | modify(
51 | states_mod,
52 | s1_bis,
53 | s3
54 | )
55 | }
56 |
57 | }
58 | \keyword{internal}
59 |
--------------------------------------------------------------------------------
/man/define_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_define.R
3 | \name{define_strategy}
4 | \alias{define_strategy}
5 | \alias{define_strategy_}
6 | \title{Define a Markov Model}
7 | \usage{
8 | define_strategy(
9 | ...,
10 | transition = define_transition(),
11 | starting_values = define_starting_values()
12 | )
13 |
14 | define_strategy_(transition, states, starting_values)
15 | }
16 | \arguments{
17 | \item{...}{Object generated by \code{\link[=define_state]{define_state()}}.}
18 |
19 | \item{transition}{An object generated by
20 | \code{\link[=define_transition]{define_transition()}}.}
21 |
22 | \item{starting_values}{Optional starting values defined
23 | with \code{\link[=define_starting_values]{define_starting_values()}}.}
24 |
25 | \item{states}{List of states, only used by
26 | \code{define_strategy_} to avoid using \code{...}.}
27 | }
28 | \value{
29 | An object of class \code{uneval_model} (a list
30 | containing the unevaluated parameters, matrix and
31 | states).
32 | }
33 | \description{
34 | Combine information on parameters, transition matrix and
35 | states defined through \code{\link[=define_parameters]{define_parameters()}},
36 | \code{\link[=define_transition]{define_transition()}} and \code{\link[=define_state]{define_state()}} respectively.
37 | }
38 | \details{
39 | This function checks whether the objects are compatible
40 | in the same model (same state names...).
41 |
42 | State values and transition probabilities referencing
43 | \code{state_time} are automatically expanded to implicit
44 | tunnel states.
45 | }
46 | \examples{
47 | mat <- define_transition(
48 | state_names = c("s1", "s2"),
49 | 1 / c, 1 - 1/ c,
50 | 0, 1
51 | )
52 |
53 | s1 <- define_state(
54 | cost = 234,
55 | utility = 1
56 | )
57 | s2 <- define_state(
58 | cost = 421,
59 | utility = .5
60 | )
61 |
62 | define_strategy(
63 | transition = mat,
64 | s1 = s1,
65 | s2 = s2
66 | )
67 | }
68 |
--------------------------------------------------------------------------------
/man/define_vbp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_define.R
3 | \name{define_vbp}
4 | \alias{define_vbp}
5 | \alias{define_vbp_}
6 | \title{Define a Value-Based Pricing Analysis}
7 | \usage{
8 | define_vbp(...)
9 |
10 | define_vbp_(par_name, low_dots, med_dots, high_dots)
11 | }
12 | \arguments{
13 | \item{...}{A parameter name and min/max values
14 | of the form \code{price, min(price), max(price)}.}
15 |
16 | \item{par_name}{String vector of price parameter name.}
17 |
18 | \item{low_dots, med_dots, high_dots}{Used to work around
19 | non-standard evaluation.}
20 | }
21 | \value{
22 | A \code{vbp} object.
23 | }
24 | \description{
25 | Define parameter variations for a value-based
26 | pricing analysis.
27 | }
28 | \examples{
29 |
30 | define_vbp(
31 | p, 0, 1000
32 | )
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/man/discount.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{discount}
4 | \alias{discount}
5 | \title{Discount a Quantity Over Time}
6 | \usage{
7 | discount(x, r, first = FALSE, time = seq_along(x))
8 | }
9 | \arguments{
10 | \item{x}{numeric. A quantity to discount.}
11 |
12 | \item{r}{discount rate.}
13 |
14 | \item{first}{logical. Should discouting start at the
15 | first value ?}
16 |
17 | \item{time}{numeric. Time values over which to discount,
18 | defaults to counting sequence of same length as x.}
19 | }
20 | \value{
21 | A numeric vector of the same length as \code{x}.
22 | }
23 | \description{
24 | Discount a Quantity Over Time
25 | }
26 | \examples{
27 |
28 | discount(rep(10, 5), .02)
29 | discount(rep(10, 5), .02, first = FALSE)
30 |
31 | }
32 | \keyword{internal}
33 |
--------------------------------------------------------------------------------
/man/discount_hack.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{discount_hack}
4 | \alias{discount_hack}
5 | \title{Hack to Work Around a Discounting Issue}
6 | \usage{
7 | discount_hack(.dots, method = "start")
8 | }
9 | \arguments{
10 | \item{.dots}{A state object.}
11 | }
12 | \value{
13 | A modified state object.
14 | }
15 | \description{
16 | This function is a hack to avoid a problem with
17 | discounting when the argument is a constant.
18 | }
19 | \details{
20 | The hack consists in replacing calls to
21 | \code{discount(x)} by \code{discount(x * rep(1, n()))} to
22 | ensure \code{x} is recycled to the correct length.
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/dispatch_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dispatch_strategy.R
3 | \name{dispatch_strategy}
4 | \alias{dispatch_strategy}
5 | \title{Dispatch Values According to Strategy}
6 | \usage{
7 | dispatch_strategy(.strategy, ...)
8 | }
9 | \arguments{
10 | \item{.strategy}{Optional strategy name. If not specified
11 | it is implicitly added.}
12 |
13 | \item{...}{Values of the parameter named depending on the
14 | strategy.}
15 | }
16 | \value{
17 | A vector of values.
18 | }
19 | \description{
20 | Returns different values depending on the strategy.
21 | }
22 | \examples{
23 |
24 | define_parameters(
25 | val = 456,
26 | x = dispatch_strategy(
27 | strat_1 = 1234,
28 | strat_2 = 9876,
29 | strat_3 = val * 2 + markov_cycle
30 | )
31 | )
32 | }
33 |
--------------------------------------------------------------------------------
/man/dispatch_strategy_hack.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dispatch_strategy.R
3 | \name{dispatch_strategy_hack}
4 | \alias{dispatch_strategy_hack}
5 | \title{Hack to Automate Use of Strategy Name}
6 | \usage{
7 | dispatch_strategy_hack(.dots)
8 | }
9 | \arguments{
10 | \item{.dots}{A \code{lazy_dots} object.}
11 | }
12 | \value{
13 | A modified \code{lazy_dots} object.
14 | }
15 | \description{
16 | This function is a hack to automate the definition of the
17 | argument \code{.strategy} in
18 | \code{\link[=dispatch_strategy]{dispatch_strategy()}}.
19 | }
20 | \details{
21 | The hack consists in replacing calls to
22 | \code{dispatch_strategy(...)} by
23 | \code{dispatch_strategy(.strategy = strategy, ...)} if
24 | \code{.strategy_name} is not already defined.
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/man/eval_models_from_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{eval_models_from_tabular}
4 | \alias{eval_models_from_tabular}
5 | \title{Evaluate Models From a Tabular Source}
6 | \usage{
7 | eval_models_from_tabular(
8 | inputs,
9 | run_dsa = TRUE,
10 | run_psa = TRUE,
11 | run_demo = TRUE,
12 | parallel = FALSE
13 | )
14 | }
15 | \arguments{
16 | \item{inputs}{Result from
17 | \code{\link[=gather_model_info]{gather_model_info()}}.}
18 |
19 | \item{run_dsa}{Run DSA?}
20 |
21 | \item{run_psa}{Run PSA?}
22 |
23 | \item{run_demo}{Run demographic analysis?}
24 | }
25 | \value{
26 | a list \itemize{ \item \code{models} (always)
27 | unevaluated model. \item \code{model_runs} (always)
28 | evaluated models \item \code{dsa} (deterministic
29 | sensitivity analysis) - if appropriate parameters
30 | provided \item \code{psa} (probabilistic sensitivity
31 | analysis) - if appropriate parameters provided \item
32 | \code{demographics} results across different
33 | demographic groups - if appropriate parameters
34 | provided}
35 | }
36 | \description{
37 | Execute a full set of analyses, possibly including
38 | discrete sensitivity analysis, probabilistic sensitivity
39 | analysis, and analyses across demographics.
40 | }
41 | \keyword{internal}
42 |
--------------------------------------------------------------------------------
/man/eval_parameters.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_eval.R
3 | \name{eval_parameters}
4 | \alias{eval_parameters}
5 | \title{Evaluate Markov model parameters}
6 | \usage{
7 | eval_parameters(
8 | x,
9 | cycles = 1,
10 | strategy_name = "",
11 | max_state_time = cycles,
12 | disc_method = "start"
13 | )
14 | }
15 | \arguments{
16 | \item{x}{an \code{uneval_parameters} object.}
17 |
18 | \item{cycles}{integer. Number of cycles to simulate.}
19 | }
20 | \value{
21 | An object of class \code{eval_parameters}
22 | (actually a data.frame with one column per parameter
23 | and one row per cycle).
24 | }
25 | \description{
26 | Evaluate parameters specified through
27 | \code{define_parameters}, for a given number of cycles.
28 | }
29 | \examples{
30 | param <- define_parameters(
31 | age_start = 60,
32 | age = age_start + markov_cycle
33 | )
34 |
35 | heRomod:::eval_parameters(param, cycles = 15)
36 | }
37 | \keyword{internal}
38 |
--------------------------------------------------------------------------------
/man/eval_resample.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/resamp_eval.R
3 | \name{eval_resample}
4 | \alias{eval_resample}
5 | \title{Evaluate Resampling Definition}
6 | \usage{
7 | eval_resample(psa, N, model = NULL)
8 | }
9 | \arguments{
10 | \item{psa}{A \code{\link[=define_psa]{define_psa()}} object.}
11 |
12 | \item{N}{Number of simulation to run.}
13 | }
14 | \value{
15 | A \code{data.frame} of resampled values with on
16 | column per parameter and \code{N} rows.
17 | }
18 | \description{
19 | Evaluate Resampling Definition
20 | }
21 | \keyword{internal}
22 |
--------------------------------------------------------------------------------
/man/eval_state_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_eval.R
3 | \name{eval_state_list}
4 | \alias{eval_state_list}
5 | \title{Evaluate Markov Model States}
6 | \usage{
7 | eval_state_list(x, parameters, expand = NULL, disc_method = "start")
8 | }
9 | \arguments{
10 | \item{x}{An \code{uneval_state_list} object generated by
11 | \code{\link[=define_state_list]{define_state_list()}}.}
12 |
13 | \item{parameters}{An \code{eval_parameters} object
14 | generated by \code{\link[=eval_parameters]{eval_parameters()}}.}
15 |
16 | \item{expand}{A tibble identifying which states
17 | should be expanded.}
18 | }
19 | \value{
20 | An \code{eval_states} object, a list with one
21 | data.frame per state containing a column per state
22 | value and a line per cycle.
23 | }
24 | \description{
25 | Evaluate Markov Model States
26 | }
27 | \keyword{internal}
28 |
--------------------------------------------------------------------------------
/man/eval_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_eval.R
3 | \name{eval_strategy}
4 | \alias{eval_strategy}
5 | \title{Evaluate Strategy}
6 | \usage{
7 | eval_strategy(
8 | strategy,
9 | parameters,
10 | cycles,
11 | init,
12 | method,
13 | expand_limit,
14 | inflow,
15 | strategy_name,
16 | aux_params = NULL,
17 | disc_method = "start",
18 | progress_reporter = create_null_prog_reporter(),
19 | state_groups = NULL,
20 | individual_level = F
21 | )
22 | }
23 | \arguments{
24 | \item{strategy}{An \code{uneval_strategy} object.}
25 |
26 | \item{parameters}{Optional. An object generated by
27 | \code{\link[=define_parameters]{define_parameters()}}.}
28 |
29 | \item{cycles}{positive integer. Number of Markov Cycles
30 | to compute.}
31 |
32 | \item{init}{numeric vector, same length as number of
33 | model states. Number of individuals in each model state
34 | at the beginning.}
35 |
36 | \item{method}{Counting method.}
37 |
38 | \item{expand_limit}{A named vector of state expansion
39 | limits.}
40 |
41 | \item{inflow}{Numeric vector, similar to \code{init}. Number
42 | of new individuals in each state per cycle.}
43 |
44 | \item{strategy_name}{Name of the strategy.}
45 | }
46 | \value{
47 | An \code{eval_strategy} object (actually a list of
48 | evaluated parameters, matrix, states and cycles
49 | counts).
50 | }
51 | \description{
52 | Given an unevaluated strategy, an initial number of
53 | individual and a number of cycle to compute, returns the
54 | evaluated version of the objects and the count of
55 | individual per state per model cycle.
56 | }
57 | \details{
58 | \code{init} need not be integer. E.g. \code{c(A = 1, B = 0.5, C = 0.1, ...)}.
59 | }
60 | \examples{
61 | param <- define_parameters(
62 | a = markov_cycle + 1 * 2
63 | )
64 |
65 | mat <- define_transition(
66 | 1-1/a, 1/a,
67 | .1, .9
68 | )
69 |
70 | mod <- define_strategy(
71 | transition = mat,
72 | A = define_state(cost = 10),
73 | B = define_state(cost = 2)
74 | )
75 |
76 | heRomod:::eval_strategy(
77 | strategy = mod,
78 | parameters = param,
79 | init = define_init(A = 10, B = 5),
80 | cycles = 5,
81 | method = "end",
82 | inflow = define_inflow(A = 0, B = 0),
83 | strategy_name = "A",
84 | expand_limit = c(A = 5, B = 5)
85 | )
86 | }
87 | \keyword{internal}
88 |
--------------------------------------------------------------------------------
/man/eval_strategy_newdata.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/newdata.R
3 | \name{eval_strategy_newdata}
4 | \alias{eval_strategy_newdata}
5 | \title{Iteratively Evaluate a Markov Model With New Parameter
6 | Values}
7 | \usage{
8 | eval_strategy_newdata(
9 | x,
10 | strategy = 1,
11 | newdata,
12 | cores = 1,
13 | create_progress_reporter = create_null_prog_reporter,
14 | progress_reporter = create_progress_reporter(),
15 | simplify = F
16 | )
17 | }
18 | \arguments{
19 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.}
20 |
21 | \item{newdata}{a data.frame whose names match parameters
22 | names. \code{model} will be evaluated iteratively,
23 | taking successive values from each row.}
24 |
25 | \item{model}{Name or index of model to recompute.}
26 | }
27 | \value{
28 | A data.frame containing the values of
29 | \code{newdata} and each Markov Model evaluation in
30 | \code{res}.
31 | }
32 | \description{
33 | Given a data.frame with on set of new parameters values
34 | per row, iteratively evaluate the model over the set of
35 | new values.
36 | }
37 | \details{
38 | New parameters with a missing value (\code{NA}) do not
39 | replace existing parameters.
40 | }
41 | \examples{
42 | par1 <- define_parameters(
43 | a = 1,
44 | b = 1 / (markov_cycle + a)
45 | )
46 |
47 | mat1 <- define_transition(
48 | 1-b, b,
49 | 0, 1
50 | )
51 | mod1 <- define_strategy(
52 | transition = mat1,
53 | define_state(var = a),
54 | define_state(var = a * markov_cycle)
55 | )
56 |
57 | res1 <- run_model(
58 | mod1,
59 | parameters = par1,
60 | cycles = 5,
61 | init = 1:0,
62 | method = "end"
63 | )
64 |
65 | new_tab <- data.frame(
66 | a = 1:10
67 | )
68 |
69 | heRomod:::eval_strategy_newdata(
70 | res1,
71 | newdata = new_tab
72 | )
73 | }
74 | \keyword{internal}
75 |
--------------------------------------------------------------------------------
/man/eval_transition.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/matrix_eval.R
3 | \name{eval_transition}
4 | \alias{eval_transition}
5 | \title{Evaluate Markov Model Transition Matrix}
6 | \usage{
7 | eval_transition(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{an \code{uneval_matrix} object.}
11 |
12 | \item{parameters}{an \code{eval_parameters} object.}
13 |
14 | \item{expand}{A tibble identifying which states
15 | should be expanded.}
16 | }
17 | \value{
18 | An \code{eval_matrix} object (actually a list of
19 | transition matrices, one per cycle).
20 | }
21 | \description{
22 | Evaluate a transition matrix using evaluated parameters.
23 | }
24 | \details{
25 | Runs checks on the transition matrix during evaluation.
26 |
27 | This functions has been heavily optimized, and thus can
28 | be difficult to read. Good luck...
29 | }
30 | \keyword{internal}
31 |
--------------------------------------------------------------------------------
/man/export_savi.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/evpi.R
3 | \name{export_savi}
4 | \alias{export_savi}
5 | \title{Export PSA Results for SAVI}
6 | \usage{
7 | export_savi(x, folder = ".")
8 | }
9 | \arguments{
10 | \item{x}{PSA result.}
11 |
12 | \item{folder}{A folder where to save the \code{csv} files.}
13 | }
14 | \value{
15 | Nothing. Creates 3 files.
16 | }
17 | \description{
18 | Export the result of a PSA in a format compatible with
19 | Sheffield Accelerated Value of Information software.
20 | }
21 | \details{
22 | This function saves 3 files at the path given by
23 | \code{folder}: \code{param.csv}, the parameter values,
24 | \code{cost.csv} and \code{effect.csv} the cost and effect
25 | results.
26 |
27 | The official SAVI website can be found at this URL:
28 | http://http://savi.shef.ac.uk/SAVI/
29 | }
30 |
--------------------------------------------------------------------------------
/man/file-checkers.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{is_csv}
4 | \alias{is_csv}
5 | \alias{is_xlsx}
6 | \alias{is_xls}
7 | \title{Check File Type}
8 | \usage{
9 | is_csv(x)
10 |
11 | is_xlsx(x)
12 |
13 | is_xls(x)
14 | }
15 | \arguments{
16 | \item{x}{A file name.}
17 | }
18 | \value{
19 | Whether the file is (respectively)
20 | csv, xlsx, or xls.
21 | }
22 | \description{
23 | Check File Type
24 | }
25 | \keyword{internal}
26 |
--------------------------------------------------------------------------------
/man/filter_blanks.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{filter_blanks}
4 | \alias{filter_blanks}
5 | \title{Remove Blank Rows From Table}
6 | \usage{
7 | filter_blanks(x)
8 | }
9 | \arguments{
10 | \item{x}{A \code{data.frame}.}
11 | }
12 | \value{
13 | A \code{data.frame} without blank rows.
14 | }
15 | \description{
16 | Remove rows were all values are \code{NA}.
17 | }
18 | \details{
19 | Some rows can be left blanks in the input table for
20 | readability, this function ensures those rows are
21 | removed.
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/man/gather_model_info.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{gather_model_info}
4 | \alias{gather_model_info}
5 | \title{Gather Information for Running a Model From Tabular Data}
6 | \usage{
7 | gather_model_info(base_dir, ref_file)
8 | }
9 | \arguments{
10 | \item{base_dir}{Directory where the files are located.}
11 |
12 | \item{ref_file}{Name of the reference file.}
13 | }
14 | \value{
15 | A list with elements: \itemize{ \item models (of
16 | type \code{uneval_model}, created by
17 | \code{\link[=create_model_list_from_tabular]{create_model_list_from_tabular()}}) \item
18 | param_info \item output_dir where to store output
19 | files, if specified \item demographic_file a table for
20 | demographic analysis \item model_options a list of
21 | model options.}
22 | }
23 | \description{
24 | Gather Information for Running a Model From Tabular Data
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/man/get_counts.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/combine.R, R/run_model_define.R
3 | \name{get_counts.updated_model}
4 | \alias{get_counts.updated_model}
5 | \alias{get_counts.combined_model}
6 | \alias{get_counts}
7 | \alias{get_counts.run_model}
8 | \alias{get_counts.eval_strategy}
9 | \alias{get_counts.list}
10 | \title{Get State Membership Counts}
11 | \usage{
12 | \method{get_counts}{updated_model}(x, ...)
13 |
14 | \method{get_counts}{combined_model}(x, ...)
15 |
16 | get_counts(x, ...)
17 |
18 | \method{get_counts}{run_model}(x, ...)
19 |
20 | \method{get_counts}{eval_strategy}(x, ...)
21 |
22 | \method{get_counts}{list}(x, ...)
23 | }
24 | \arguments{
25 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.}
26 |
27 | \item{...}{further arguments passed to or from other
28 | methods.}
29 | }
30 | \value{
31 | A data frame of counts per state.
32 | }
33 | \description{
34 | Given a result from \code{\link[=run_model]{run_model()}}, return
35 | state membership counts for a specific strategy.
36 | }
37 |
--------------------------------------------------------------------------------
/man/get_frontier.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/efficiency_frontier.R
3 | \name{get_frontier}
4 | \alias{get_frontier}
5 | \title{Return Efficiency Frontier}
6 | \usage{
7 | get_frontier(x)
8 | }
9 | \arguments{
10 | \item{x}{An \code{eval_strategy_list} object.}
11 | }
12 | \value{
13 | A vector of model names on the efficiency
14 | frontier.
15 | }
16 | \description{
17 | Return Efficiency Frontier
18 | }
19 | \keyword{internal}
20 |
--------------------------------------------------------------------------------
/man/get_matrix_order.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/matrix_define.R
3 | \name{get_matrix_order}
4 | \alias{get_matrix_order}
5 | \title{Return Markov Model Transition Matrix Order}
6 | \usage{
7 | get_matrix_order(x)
8 | }
9 | \arguments{
10 | \item{x}{A transition matrix, evaluated or not.}
11 | }
12 | \value{
13 | An integer: matrix order.
14 | }
15 | \description{
16 | A generic that works both with \code{uneval_matrix} and
17 | \code{eval_matrix}.
18 | }
19 | \details{
20 | For internal use.
21 | }
22 | \keyword{internal}
23 |
--------------------------------------------------------------------------------
/man/get_parameter_names.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_define.R
3 | \name{get_parameter_names}
4 | \alias{get_parameter_names}
5 | \title{Return parameters names}
6 | \usage{
7 | get_parameter_names(x)
8 | }
9 | \arguments{
10 | \item{x}{An object with parameters.}
11 | }
12 | \value{
13 | A character vector of parameter names.
14 | }
15 | \description{
16 | Extract parameters names.
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/get_state_names.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{get_state_names}
4 | \alias{get_state_names}
5 | \title{Get State Names}
6 | \usage{
7 | get_state_names(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{An object containing states.}
11 |
12 | \item{...}{Additional arguments passed to methods.}
13 | }
14 | \value{
15 | A character vector of state names.
16 | }
17 | \description{
18 | Retrieve state names from an object containing states.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/get_state_number.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{get_state_number}
4 | \alias{get_state_number}
5 | \title{Return Number of State}
6 | \usage{
7 | get_state_number(x)
8 | }
9 | \arguments{
10 | \item{x}{An object containing states.}
11 | }
12 | \value{
13 | An integer: number of states.
14 | }
15 | \description{
16 | For internal use.
17 | }
18 | \details{
19 | Work with both \code{uneval_states} and
20 | \code{eval_states}.
21 | }
22 | \keyword{internal}
23 |
--------------------------------------------------------------------------------
/man/get_state_value_names.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/states_define.R
3 | \name{get_state_value_names}
4 | \alias{get_state_value_names}
5 | \title{Return Names of State Values}
6 | \usage{
7 | get_state_value_names(x)
8 | }
9 | \arguments{
10 | \item{x}{An object containing states.}
11 |
12 | \item{...}{Additional arguments passed to methods.}
13 | }
14 | \value{
15 | A character vector of state value names.
16 | }
17 | \description{
18 | Return Names of State Values
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/get_transition.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_define.R
3 | \name{get_transition}
4 | \alias{get_transition}
5 | \title{Get Markov Model Transition Matrix}
6 | \usage{
7 | get_transition(x)
8 | }
9 | \arguments{
10 | \item{x}{An \code{uneval_model} or \code{eval_model}
11 | object.}
12 | }
13 | \value{
14 | An \code{uneval_matrix} or \code{uneval_matrix}
15 | object.
16 | }
17 | \description{
18 | Works on both unevaluated and evaluated models.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/get_values.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/combine.R, R/run_model_define.R
3 | \name{get_values.updated_model}
4 | \alias{get_values.updated_model}
5 | \alias{get_values.combined_model}
6 | \alias{get_values}
7 | \alias{get_values.run_model}
8 | \alias{get_values.eval_strategy}
9 | \alias{get_values.list}
10 | \title{Get Strategy Values}
11 | \usage{
12 | \method{get_values}{updated_model}(x, ...)
13 |
14 | \method{get_values}{combined_model}(x, ...)
15 |
16 | get_values(x, ...)
17 |
18 | \method{get_values}{run_model}(x, ...)
19 |
20 | \method{get_values}{eval_strategy}(x, ...)
21 |
22 | \method{get_values}{list}(x, ...)
23 | }
24 | \arguments{
25 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.}
26 |
27 | \item{...}{further arguments passed to or from other
28 | methods.}
29 | }
30 | \value{
31 | A data frame of values per state.
32 | }
33 | \description{
34 | Given a result from \code{\link[=run_model]{run_model()}}, return
35 | cost and effect values for a specific strategy.
36 | }
37 |
--------------------------------------------------------------------------------
/man/heRomod.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/heRomod.R
3 | \docType{package}
4 | \name{heRomod}
5 | \alias{heRomod}
6 | \title{heRomod: Health Economic Evaluation MODelling}
7 | \description{
8 | \code{heRomod} is an R toolset for health economic
9 | evaluation modelling. It aims to provide a simple and
10 | consistent interface for Markov models specification and
11 | comparison. Non-homogeneous Markov models (with time
12 | varying properties) are supported.
13 | }
14 |
--------------------------------------------------------------------------------
/man/heRomod_scale.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/combine.R, R/resamp_print.R,
3 | % R/run_model_summary.R, R/sensitivity_print.R
4 | \name{scale.combined_model}
5 | \alias{scale.combined_model}
6 | \alias{scale.psa}
7 | \alias{heRomod_scale}
8 | \alias{scale.run_model}
9 | \alias{scale.dsa}
10 | \title{Normalize Cost and Effect}
11 | \usage{
12 | \method{scale}{combined_model}(x, center = FALSE, scale = TRUE)
13 |
14 | \method{scale}{psa}(x, center = TRUE, scale = TRUE)
15 |
16 | \method{scale}{run_model}(x, center = FALSE, scale = TRUE)
17 |
18 | \method{scale}{dsa}(x, center = TRUE, scale = TRUE)
19 | }
20 | \arguments{
21 | \item{x}{Result of \code{\link[=run_model]{run_model()}} or
22 | \code{\link[=run_psa]{run_psa()}}.}
23 |
24 | \item{center}{Center results around base model?}
25 |
26 | \item{scale}{Scale results to individual values?}
27 | }
28 | \value{
29 | Input with normalized \code{.cost} and
30 | \code{.effect}, ordered by \code{.effect}.
31 | }
32 | \description{
33 | Normalize cost and effect values taking base model as a
34 | reference.
35 | }
36 | \keyword{internal}
37 |
--------------------------------------------------------------------------------
/man/insert.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{insert}
4 | \alias{insert}
5 | \title{Insert Elements in Vector}
6 | \usage{
7 | insert(x, pos, what)
8 | }
9 | \arguments{
10 | \item{x}{A vector (or a list).}
11 |
12 | \item{pos}{Integer. Insert after which elements?}
13 |
14 | \item{what}{Vector of elements to insert.}
15 | }
16 | \value{
17 | A vector.
18 | }
19 | \description{
20 | Insert a vector in another vector.
21 | }
22 | \details{
23 | To insert an element at the beginning use a \code{pos}
24 | value of 0.
25 |
26 | Duplicated positions are not allowed.
27 | }
28 | \examples{
29 |
30 | heRomod:::insert(letters, c(0, 5, 26), c("xxx", "yyy"))
31 |
32 | }
33 | \keyword{internal}
34 |
--------------------------------------------------------------------------------
/man/interpolate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/expand.R
3 | \name{interpolate}
4 | \alias{interpolate}
5 | \alias{interpolate.default}
6 | \alias{interpolate.uneval_matrix}
7 | \alias{interpolate.state}
8 | \alias{interpolate.state_transition}
9 | \alias{interpolate.part_surv}
10 | \alias{interpolate.part_surv_custom}
11 | \alias{interpolate.uneval_state_list}
12 | \alias{interpolate.uneval_state_transition_list}
13 | \title{Interpolate Lazy Dots}
14 | \usage{
15 | interpolate(x, ...)
16 |
17 | \method{interpolate}{default}(x, more = NULL, ...)
18 |
19 | \method{interpolate}{uneval_matrix}(x, ...)
20 |
21 | \method{interpolate}{state}(x, ...)
22 |
23 | \method{interpolate}{state_transition}(x, ...)
24 |
25 | \method{interpolate}{part_surv}(x, ...)
26 |
27 | \method{interpolate}{part_surv_custom}(x, ...)
28 |
29 | \method{interpolate}{uneval_state_list}(x, ...)
30 |
31 | \method{interpolate}{uneval_state_transition_list}(x, ...)
32 | }
33 | \arguments{
34 | \item{x}{A parameter, transition matrix or state list
35 | object.}
36 |
37 | \item{...}{Addition parameters passed to methods.}
38 |
39 | \item{more}{A list of expressions.}
40 | }
41 | \value{
42 | An interpolated lazy dots object.
43 | }
44 | \description{
45 | Sequentially interpolates lazy dots, optionally using
46 | external references.
47 | }
48 | \details{
49 | The interpolation is sequential: the second dot is
50 | interpolated using the first, the third using the
51 | interpolated first two, and so on.
52 | }
53 | \keyword{internal}
54 |
--------------------------------------------------------------------------------
/man/is.wholenumber.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{is.wholenumber}
4 | \alias{is.wholenumber}
5 | \title{Check Wholenumbers}
6 | \usage{
7 | is.wholenumber(x, tol = .Machine$double.eps^0.5)
8 | }
9 | \arguments{
10 | \item{x}{numeric.}
11 |
12 | \item{tol}{the smallest positive floating-point number x
13 | such that 1 + x != 1.}
14 | }
15 | \value{
16 | A logical scalar.
17 | }
18 | \description{
19 | Check Wholenumbers
20 | }
21 | \keyword{internal}
22 |
--------------------------------------------------------------------------------
/man/list_all_same.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{list_all_same}
4 | \alias{list_all_same}
5 | \title{Check if All the Elements of a List Are the Same}
6 | \usage{
7 | list_all_same(x)
8 | }
9 | \arguments{
10 | \item{x}{a list.}
11 | }
12 | \value{
13 | A logical scalar.
14 | }
15 | \description{
16 | Check if All the Elements of a List Are the Same
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/look_up.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/look_up.R
3 | \name{look_up}
4 | \alias{look_up}
5 | \title{Look Up Values in a Data Frame}
6 | \usage{
7 | look_up(data, ..., bin = FALSE, value = "value")
8 | }
9 | \arguments{
10 | \item{data}{A reference data frame.}
11 |
12 | \item{...}{Individual characteristics, should be named
13 | like the columns of \code{data}.}
14 |
15 | \item{bin}{Either logical: should all numeric variable be
16 | binned, or character vector giving the names of
17 | variables to bin (see examples).}
18 |
19 | \item{value}{The value to extract ffrom the reference
20 | data frame.}
21 | }
22 | \value{
23 | A vector of values, same lenght as \code{...}.
24 | }
25 | \description{
26 | A convenience function to easily look for values in a
27 | data frame.
28 | }
29 | \details{
30 | This function is mostly used to extract population
31 | informations (such as mortality rates), given some
32 | individual caracteristics.
33 |
34 | If binning is activated, numeric individual
35 | characteristics are matched to the corresponding
36 | reference value that is directly inferior.
37 | }
38 | \examples{
39 | tempdf <- expand.grid(arg1 = c("A", "B", "C"), arg2 = 1:4, arg3 = 1:5)
40 | tempdf$value <- 1:60
41 |
42 | look_up(
43 | data = tempdf,
44 | value = "value",
45 | arg1 = c("A", "B", "C", "B", "A"),
46 | arg2 = c(1, 1, 3.2, 3.0, 5),
47 | arg3 = c(-1, 1, 1, 2, 3)
48 | )
49 |
50 | # binning doesnt catch values lesser than the smaller
51 | # reference value
52 | look_up(
53 | data = tempdf,
54 | value = "value",
55 | arg1 = c("A", "B", "C", "B", "A"),
56 | arg2 = c(1, 1, 3.2, 3.0, 5),
57 | arg3 = c(-1, 1, 1, 2, 3),
58 | bin = TRUE
59 | )
60 | # bin can alos be given as a charater vector
61 | # to avoid binning all numeric variables
62 | look_up(
63 | data = tempdf,
64 | value = "value",
65 | arg1 = c("A", "B", "C", "B", "A"),
66 | arg2 = c(1, 1, 3.2, 3.0, 5),
67 | arg3 = c(-1, 1, 1, 2, 3),
68 | bin = c("arg2")
69 | )
70 |
71 | age_related_df <- data.frame(age = 10 * 0:9, decade = 1:10)
72 |
73 | look_up(age_related_df, age = c(0, 10, 20), value = "decade")
74 |
75 | # binning might help in the situation
76 | look_up(age_related_df, age = c(5, 15, 23.5),
77 | value = "decade")
78 | look_up(age_related_df, age = c(5, 15, 23.5),
79 | value = "decade", bin = TRUE)
80 | }
81 |
--------------------------------------------------------------------------------
/man/make_names.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{make_names}
4 | \alias{make_names}
5 | \title{Make Syntactically Valid Names}
6 | \usage{
7 | make_names(x)
8 | }
9 | \arguments{
10 | \item{x}{A character vector.}
11 | }
12 | \value{
13 | A character vector.
14 | }
15 | \description{
16 | Compared to \code{\link[=make.names]{make.names()}} this function also
17 | converts characters to lower case and replaces \code{.}
18 | by \verb{_}.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/mclapply.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/parallelsugar.R
3 | \name{mclapply}
4 | \alias{mclapply}
5 | \title{Overwrite the serial version of mclapply on Windows only}
6 | \usage{
7 | mclapply(
8 | X,
9 | FUN,
10 | ...,
11 | mc.preschedule = TRUE,
12 | mc.set.seed = TRUE,
13 | mc.silent = FALSE,
14 | mc.cores = getOption("mc.cores", 2L),
15 | mc.cleanup = TRUE,
16 | mc.allow.recursive = TRUE,
17 | affinity.list = NULL
18 | )
19 | }
20 | \arguments{
21 | \item{empty}{it takes nothing}
22 | }
23 | \value{
24 | mclapply like list
25 | }
26 | \description{
27 | Overwrite the serial version of mclapply on Windows only
28 | }
29 |
--------------------------------------------------------------------------------
/man/mclapply_socket.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/parallelsugar.R
3 | \name{mclapply_socket}
4 | \alias{mclapply_socket}
5 | \title{Define a sockets version of mclapply}
6 | \usage{
7 | mclapply_socket(
8 | X,
9 | FUN,
10 | ...,
11 | mc.preschedule = TRUE,
12 | mc.set.seed = TRUE,
13 | mc.silent = FALSE,
14 | mc.cores = NULL,
15 | mc.cleanup = TRUE,
16 | mc.allow.recursive = TRUE
17 | )
18 | }
19 | \arguments{
20 | \item{...}{What you pass to mclapply}
21 | }
22 | \value{
23 | mclapply like list
24 | }
25 | \description{
26 | An implementation of \code{\link[parallel]{mclapply}} using \code{parallel::parLapply}
27 | }
28 | \details{
29 | Windows does not support forking. This makes it impossible to use mclapply on Windows to
30 | farm out work to additional cores.
31 |
32 | More words
33 | }
34 |
--------------------------------------------------------------------------------
/man/modify.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/param_define.R
3 | \name{modify}
4 | \alias{modify}
5 | \title{Modify Object}
6 | \usage{
7 | modify(.OBJECT, ...)
8 | }
9 | \arguments{
10 | \item{.OBJECT}{Various objects.}
11 |
12 | \item{...}{Modifications.}
13 | }
14 | \value{
15 | Same class as \code{x}.
16 | }
17 | \description{
18 | This generic function allows the modification of various
19 | objects such as parameters, transitions matrix or states.
20 | }
21 | \details{
22 | More details are available on the respective help page of
23 | each object definition.
24 | }
25 |
--------------------------------------------------------------------------------
/man/p_comp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_eval.R
3 | \name{p_comp}
4 | \alias{p_comp}
5 | \title{Price of comparator strategy}
6 | \usage{
7 | p_comp(e.P, e.comp, beta0.P, beta0.comp, beta1.P, beta1.comp, lambda)
8 | }
9 | \arguments{
10 | \item{e.P}{Effectiveness of strategy of interest}
11 |
12 | \item{e.comp}{Effectiveness of comparator strategy}
13 |
14 | \item{beta0.P}{Intercept of strategy of interest}
15 |
16 | \item{beta0.comp}{Intercept of comparator strategy}
17 |
18 | \item{beta1.P}{Slope of strategy of interest}
19 |
20 | \item{beta1.comp}{Slope of comparator strategy}
21 |
22 | \item{lambda}{Vector of willingness to pay thresholds}
23 | }
24 | \value{
25 | Vector of prices of comparator strategy
26 | }
27 | \description{
28 | Returns the cost and effectiveness for selected strategy
29 | }
30 |
--------------------------------------------------------------------------------
/man/param_in_strategy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_eval.R
3 | \name{param_in_strategy}
4 | \alias{param_in_strategy}
5 | \title{Parameter influences strategy}
6 | \usage{
7 | param_in_strategy(mod, strategy, parameter)
8 | }
9 | \arguments{
10 | \item{mod}{An evaluated Markov model}
11 |
12 | \item{strategy}{Strategy of interest}
13 |
14 | \item{parameter}{Parameter of interest}
15 | }
16 | \value{
17 | TRUE if parameter potentially influences strategy, FALSE otherwise
18 | }
19 | \description{
20 | Determines if parameter influences strategy
21 | }
22 |
--------------------------------------------------------------------------------
/man/parse_multi_spec.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{parse_multi_spec}
4 | \alias{parse_multi_spec}
5 | \title{Specify Inputs for Multiple Models From a Single File}
6 | \usage{
7 | parse_multi_spec(multi_spec, split_on = ".model", group_vars)
8 | }
9 | \arguments{
10 | \item{multi_spec}{\verb{data frame}.}
11 |
12 | \item{split_on}{\code{character} of length 1, with the
13 | name of the variable in \code{multi_spec} to be split
14 | on.}
15 |
16 | \item{group_vars}{\code{character}, one or more variable
17 | names from \code{multi_spec} that identify a line of
18 | information.}
19 | }
20 | \value{
21 | A list of data frames, one for each value of
22 | \code{split_on.}
23 | }
24 | \description{
25 | Parse a \code{data.frame} containing specifications for
26 | multiple models into a list of inputs required for each
27 | model.
28 | }
29 | \details{
30 | Each combination of values of the columns specified by
31 | \code{group_vars} should either be unique in the file (in
32 | which case it will be replicated for all values of
33 | \code{split_on}), or must be repeated as many times as
34 | unique values of \code{split_on}.
35 |
36 | \code{split_on} is usually the model name.
37 |
38 | \code{group_var} can be the state names, or from and to
39 | lines for a matrix definition...
40 | }
41 | \keyword{internal}
42 |
--------------------------------------------------------------------------------
/man/plot.dsa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sensitivity_print.R
3 | \name{plot.dsa}
4 | \alias{plot.dsa}
5 | \title{Plot Sensitivity Analysis}
6 | \usage{
7 | \method{plot}{dsa}(
8 | x,
9 | type = c("simple", "difference"),
10 | result = c("cost", "effect", "icer"),
11 | strategy = NULL,
12 | widest_on_top = TRUE,
13 | limits_by_bars = TRUE,
14 | resolve_labels = FALSE,
15 | shorten_labels = FALSE,
16 | remove_ns = FALSE,
17 | bw = FALSE,
18 | ...
19 | )
20 | }
21 | \arguments{
22 | \item{x}{A result of \code{\link[=run_dsa]{run_dsa()}}.}
23 |
24 | \item{type}{Type of plot (see details).}
25 |
26 | \item{result}{Plot cost, effect, or ICER.}
27 |
28 | \item{strategy}{Name or index of strategies to plot.}
29 |
30 | \item{widest_on_top}{logical. Should bars be sorted so
31 | widest are on top?}
32 |
33 | \item{limits_by_bars}{logical. Should the limits used
34 | for each parameter be printed in the plot, next to the
35 | bars?}
36 |
37 | \item{resolve_labels}{logical. Should we resolve all
38 | labels to numbers instead of expressions (if there are
39 | any)?}
40 |
41 | \item{shorten_labels}{logical. Should we shorten the
42 | presentation of the parameters on the plot to highlight
43 | where the values differ?}
44 |
45 | \item{remove_ns}{Remove variables that are not sensitive.}
46 |
47 | \item{bw}{Black & white plot for publications?}
48 |
49 | \item{...}{Additional arguments passed to \code{plot}.}
50 | }
51 | \value{
52 | A \code{ggplot2} object.
53 | }
54 | \description{
55 | Plot the results of a sensitivity analysis as a tornado
56 | plot.
57 | }
58 | \details{
59 | Plot type \code{simple} plots variations of single strategy
60 | values, while \code{difference} plots incremental values.
61 | }
62 |
--------------------------------------------------------------------------------
/man/plot.evppi_res.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/evppi_print.R
3 | \name{plot.evppi_res}
4 | \alias{plot.evppi_res}
5 | \title{Plot Results of Expected Value of Partial Perfect Information Analysis}
6 | \usage{
7 | \method{plot}{evppi_res}(x, bw = FALSE, ...)
8 | }
9 | \arguments{
10 | \item{x}{Result from \code{\link[=compute_evppi]{compute_evppi()}}.}
11 |
12 | \item{bw}{Black & white plot for publications?}
13 |
14 | \item{...}{Additional arguments, depends on \code{type}.}
15 | }
16 | \value{
17 | A \code{ggplot2} object.
18 | }
19 | \description{
20 | Plot of EVPPI for one or more parameters by willingness to pay threshold
21 | }
22 |
--------------------------------------------------------------------------------
/man/plot.psa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/resamp_print.R
3 | \name{plot.psa}
4 | \alias{plot.psa}
5 | \title{Plot Results of Probabilistic Analysis}
6 | \usage{
7 | \method{plot}{psa}(
8 | x,
9 | type = c("ce", "ac", "cov", "evpi"),
10 | max_wtp = 1e+05,
11 | n = 100,
12 | log_scale = TRUE,
13 | diff = FALSE,
14 | threshold,
15 | bw = FALSE,
16 | ...
17 | )
18 | }
19 | \arguments{
20 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.}
21 |
22 | \item{type}{Type of plot, see details.}
23 |
24 | \item{max_wtp}{Maximal willingness to pay.}
25 |
26 | \item{n}{Number of CECA points to estimate (values above
27 | 100 may take significant time).}
28 |
29 | \item{log_scale}{Show willingness to pay on a log scale?}
30 |
31 | \item{diff}{Logical, perform covariance analysis on
32 | strategy differences?}
33 |
34 | \item{threshold}{When \code{diff = TRUE}, threshlod value
35 | for net monetary benefit computation.}
36 |
37 | \item{bw}{Black & white plot for publications?}
38 |
39 | \item{...}{Additional arguments, depends on \code{type}.}
40 | }
41 | \value{
42 | A \code{ggplot2} object.
43 | }
44 | \description{
45 | Various plots for Markov models probabilistic analysis.
46 | }
47 | \details{
48 | \code{type = "ac"} plots cost-effectiveness acceptability
49 | curves, \code{type = "ce"} plots results on the
50 | cost-efficiency plane, \code{type = "cov"} to perform
51 | covariance analysis on the results, \code{type = "evpi"}
52 | for expected value of perfect information.
53 | }
54 |
--------------------------------------------------------------------------------
/man/plot.run_model.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/strategy_print.R
3 | \name{plot.run_model}
4 | \alias{plot.run_model}
5 | \title{Plot Results of a Markov Model}
6 | \usage{
7 | \method{plot}{run_model}(
8 | x,
9 | type = c("counts", "ce", "values"),
10 | panels = c("by_strategy", "by_state", "by_value"),
11 | values = NULL,
12 | strategy = NULL,
13 | states = NULL,
14 | free_y = FALSE,
15 | bw = FALSE,
16 | ...
17 | )
18 | }
19 | \arguments{
20 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.}
21 |
22 | \item{type}{Type of plot, see details.}
23 |
24 | \item{panels}{Should plots be faceted by model, by
25 | value or by state?}
26 |
27 | \item{values}{Names of values to be plotted. These can be
28 | any of the costs or effects defined in states.}
29 |
30 | \item{strategy}{Name or position of model(s) of interest.}
31 |
32 | \item{states}{Names of states to be included in
33 | the plot.}
34 |
35 | \item{free_y}{Should y limits be free between panels?}
36 |
37 | \item{bw}{Black & white plot for publications?}
38 |
39 | \item{...}{Additional arguments passed to \code{plot}.
40 |
41 | \code{type = "counts"} represents state
42 | memberships (corrected) by cycle, \code{type = "ce"}
43 | plots models on the cost-efficiency plane with the
44 | efficiency frontier, and \code{type = "values"} state
45 | values per cycle.
46 |
47 | When \code{states} is specified, the states will be turned into
48 | a factor with the ordering given in the variable, so that
49 | plotting order can be controlled.}
50 | }
51 | \value{
52 | A \code{ggplot2} object.
53 | }
54 | \description{
55 | Various plots for Markov models.
56 | }
57 | \examples{
58 |
59 | ## These examples require \code{res_mod} from the hip replacement model discussed in
60 | ## `vignette("non-homogeneous", package = "heRomod")`.
61 |
62 | \dontrun{
63 | plot(res_mod)
64 |
65 | plot(res_mod, model = "all")
66 | plot(res_mod, model = "all", panels = "by_state")
67 |
68 | plot(res_mod, model = "all", include_states = c("RevisionTHR", "SuccessR"))
69 | plot(res_mod, model = "all", panels = "by_state", include_states = c("RevisionTHR", "SuccessR"))
70 |
71 | plot(res_mod, model = 2, panel = "by_state", include_states = c("RevisionTHR", "SuccessR"))
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/man/plot.vbp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_print.R
3 | \name{plot.vbp}
4 | \alias{plot.vbp}
5 | \title{Plot Sensitivity Analysis}
6 | \usage{
7 | \method{plot}{vbp}(x, bw = FALSE, ...)
8 | }
9 | \arguments{
10 | \item{x}{A result of \code{\link[=run_vbp]{run_vbp()}}.}
11 |
12 | \item{bw}{Black & white plot for publications?}
13 |
14 | \item{...}{Additional arguments passed to \code{plot}.}
15 | }
16 | \value{
17 | A \code{ggplot2} object.
18 | }
19 | \description{
20 | Plot the results of a sensitivity analysis as a tornado
21 | plot.
22 | }
23 | \details{
24 | Plot type \code{simple} plots variations of single strategy
25 | values, while \code{difference} plots incremental values.
26 | }
27 |
--------------------------------------------------------------------------------
/man/plur.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{plur}
4 | \alias{plur}
5 | \alias{plur_y}
6 | \title{Returns "s" if x > 1}
7 | \usage{
8 | plur(x)
9 |
10 | plur_y(x)
11 | }
12 | \arguments{
13 | \item{x}{integer.}
14 | }
15 | \value{
16 | \code{"s"} or \code{""}.
17 | }
18 | \description{
19 | Returns "s" if x > 1
20 | }
21 | \keyword{internal}
22 |
--------------------------------------------------------------------------------
/man/probability.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/transform.R
3 | \name{probability}
4 | \alias{probability}
5 | \alias{rescale_prob}
6 | \alias{prob_to_prob}
7 | \alias{rate_to_prob}
8 | \alias{or_to_prob}
9 | \alias{rr_to_prob}
10 | \title{Convenience Functions to Compute Probabilities}
11 | \usage{
12 | rescale_prob(p, to = 1, from = 1)
13 |
14 | prob_to_prob(...)
15 |
16 | rate_to_prob(r, to = 1, per = 1)
17 |
18 | or_to_prob(or, p)
19 |
20 | rr_to_prob(rr, p)
21 | }
22 | \arguments{
23 | \item{p}{Probability.}
24 |
25 | \item{to}{Compute probability for that timeframe.}
26 |
27 | \item{from}{Timeframe of the original probability.}
28 |
29 | \item{...}{For deprecated functions.}
30 |
31 | \item{r}{Rate.}
32 |
33 | \item{per}{Number of person-time corresponding to the
34 | rate.}
35 |
36 | \item{or}{Odds ratio.}
37 |
38 | \item{rr}{Relative risk.}
39 | }
40 | \value{
41 | A probability.
42 | }
43 | \description{
44 | These convienience functions make it easier to compute
45 | transition probabilities from indidence rates, OR, RR, or
46 | probabilities estimated on a different timeframe.
47 | }
48 | \examples{
49 | # convert 5-year probability
50 | # to 1-year probability
51 | rescale_prob(p = .65, from = 5)
52 |
53 | # convert 1-year probability
54 | # to 1-month probability
55 | rescale_prob(p = .5, to = 1/12)
56 |
57 | # convert rate per 1000 PY
58 | # to 5-year probability
59 | rate_to_prob(r = 162, per = 1000, to = 5)
60 |
61 | # convert OR to probability
62 | or_to_prob(or = 1.9, p = .51)
63 |
64 | # convert RR to probability
65 | rr_to_prob(rr = 1.9, p = .51)
66 | }
67 |
--------------------------------------------------------------------------------
/man/read_file.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{read_file}
4 | \alias{read_file}
5 | \title{Read the accepted file formats for tabular input}
6 | \usage{
7 | read_file(file_name)
8 | }
9 | \arguments{
10 | \item{file_name}{File name.}
11 | }
12 | \value{
13 | A \code{data.frame}.
14 | }
15 | \description{
16 | Columns starting with '.comment' are ignored.
17 | }
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/reexports.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/heRomod.R
3 | \docType{import}
4 | \name{reexports}
5 | \alias{reexports}
6 | \alias{\%>\%}
7 | \title{Objects exported from other packages}
8 | \keyword{internal}
9 | \description{
10 | These objects are imported from other packages. Follow the links
11 | below to see their documentation.
12 |
13 | \describe{
14 | \item{dplyr}{\code{\link[dplyr:reexports]{\%>\%}}}
15 | }}
16 |
17 |
--------------------------------------------------------------------------------
/man/reindent_transition.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/matrix_plot.R
3 | \name{reindent_transition}
4 | \alias{reindent_transition}
5 | \title{Reindent Transition Matrix}
6 | \usage{
7 | reindent_transition(x, print = TRUE)
8 | }
9 | \arguments{
10 | \item{x}{A transition matrix.}
11 |
12 | \item{print}{Print result?}
13 | }
14 | \value{
15 | The reindented matrix as a text string,
16 | invisibly.
17 | }
18 | \description{
19 | Reindent Transition Matrix
20 | }
21 |
--------------------------------------------------------------------------------
/man/rescale_discount_rate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/transform.R
3 | \name{rescale_discount_rate}
4 | \alias{rescale_discount_rate}
5 | \title{Rescale Discount Rate}
6 | \usage{
7 | rescale_discount_rate(x, from, to)
8 | }
9 | \arguments{
10 | \item{x}{Discount rate to rescale.}
11 |
12 | \item{from}{Original time period.}
13 |
14 | \item{to}{Final time period.}
15 | }
16 | \value{
17 | Rate rescaled under the assumption of compound
18 | discounting.
19 | }
20 | \description{
21 | Rescale a discount rate between two time frames.
22 | }
23 | \details{
24 | Continuous discounting is assumed, i.e. when converting a
25 | long-term discount rate into a short-term rate, we assume
26 | that a partial gain from one short term is
27 | multiplicatively discounted in all following short terms.
28 | At the same time, we assume the short-term rate is
29 | time-invariant.
30 | }
31 | \examples{
32 | ## 1\% monthly interest rate to annual
33 | rescale_discount_rate(0.01, 1, 12)
34 | ## 3\% annual discount rate to (approximately) weekly
35 | rescale_discount_rate(0.03, 52, 1)
36 | }
37 |
--------------------------------------------------------------------------------
/man/resolve_dependencies.default.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{resolve_dependencies.default}
4 | \alias{resolve_dependencies.default}
5 | \title{Reorder a list of expressions to resolve dependencies}
6 | \usage{
7 | \method{resolve_dependencies}{default}(x)
8 | }
9 | \description{
10 | Reorder a list of expressions to resolve dependencies
11 | }
12 |
--------------------------------------------------------------------------------
/man/run_bcea.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/evpi.R
3 | \name{run_bcea}
4 | \alias{run_bcea}
5 | \title{Use the BCEA package}
6 | \usage{
7 | run_bcea(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{Output from \code{\link[=run_psa]{run_psa()}}.}
11 |
12 | \item{...}{Additional arguemnts passed to \code{\link[BCEA:bcea]{BCEA::bcea()}}.}
13 | }
14 | \value{
15 | A BCEA analysis.
16 | }
17 | \description{
18 | Interfaces the output of \code{\link[=run_psa]{run_psa()}} into the BCEA package.
19 | }
20 | \details{
21 | The BCEA package is needed for this function to work.
22 | }
23 |
--------------------------------------------------------------------------------
/man/run_dsa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sensitivity_eval.R
3 | \name{run_dsa}
4 | \alias{run_dsa}
5 | \title{Run Sensitivity Analysis}
6 | \usage{
7 | run_dsa(
8 | model,
9 | dsa,
10 | cores = 1,
11 | create_progress_reporter = create_null_prog_reporter,
12 | progress_reporter = create_progress_reporter()
13 | )
14 | }
15 | \arguments{
16 | \item{model}{An evaluated Markov model.}
17 |
18 | \item{dsa}{An object returned by
19 | \code{\link[=define_dsa]{define_dsa()}}.}
20 | }
21 | \value{
22 | A \code{data.frame} with one row per model and
23 | parameter value.
24 | }
25 | \description{
26 | Run Sensitivity Analysis
27 | }
28 | \examples{
29 | param <- define_parameters(
30 | p1 = .5,
31 | p2 = .2,
32 | r = .05
33 | )
34 | mod1 <- define_strategy(
35 | transition = define_transition(
36 | C, p1,
37 | p2, C
38 | ),
39 | define_state(
40 | cost = discount(543, r),
41 | ly = 1
42 | ),
43 | define_state(
44 | cost = discount(432, r),
45 | ly = .5
46 | )
47 | )
48 |
49 | mod2 <- define_strategy(
50 | transition = define_transition(
51 | C, p1,
52 | p2, C
53 | ),
54 | define_state(
55 | cost = 789,
56 | ly = 1
57 | ),
58 | define_state(
59 | cost = 456,
60 | ly = .8
61 | )
62 | )
63 |
64 | res2 <- run_model(
65 | mod1, mod2,
66 | parameters = param,
67 | init = c(100, 0),
68 | cycles = 10,
69 | cost = cost,
70 | effect = ly
71 | )
72 |
73 | ds <- define_dsa(
74 | p1, .1, .9,
75 | p2, .1, .3,
76 | r, .05, .1
77 | )
78 | print(ds)
79 |
80 | x <- run_dsa(res2, ds)
81 |
82 | plot(x, value = "cost")
83 |
84 | # can be specified as a function of other parameters
85 |
86 |
87 | ds2 <- define_dsa(
88 | p2, p1 - .1, p1 + .1
89 | )
90 |
91 | run_dsa(res2, ds2)
92 | }
93 |
--------------------------------------------------------------------------------
/man/run_model_tabular.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{run_model_tabular}
4 | \alias{run_model_tabular}
5 | \title{Run Analyses From Files}
6 | \usage{
7 | run_model_tabular(
8 | location,
9 | reference = "REFERENCE.csv",
10 | run_dsa = TRUE,
11 | run_psa = TRUE,
12 | run_demo = TRUE,
13 | save = FALSE,
14 | overwrite = FALSE
15 | )
16 | }
17 | \arguments{
18 | \item{location}{Directory where the files are located.}
19 |
20 | \item{reference}{Name of the reference file.}
21 |
22 | \item{run_dsa}{Run DSA?}
23 |
24 | \item{run_psa}{Run PSA?.}
25 |
26 | \item{run_demo}{Run demgraphic analysis?}
27 |
28 | \item{save}{Should the outputs be saved?}
29 |
30 | \item{overwrite}{Should the outputs be overwritten?}
31 | }
32 | \value{
33 | A list of evaluated models (always), and, if
34 | appropriate input is provided, dsa (deterministic
35 | sensitivity analysis), psa (probabilistic sensitivity
36 | analysis) and demographics (results across different
37 | demographic groups).
38 | }
39 | \description{
40 | This function runs a model from tabular input.
41 | }
42 | \details{
43 | The reference file should have two columns, \code{data}
44 | and \code{file}. An optional \code{absolute_path} column
45 | can be added, having value \code{TRUE} where an absolute
46 | file path is provided. \code{data} values must include
47 | \code{state}, \code{tm}, and \code{parameters}, and can
48 | also include \code{options}, \code{demographics} and
49 | \code{data}. The corresponding values in the \code{file}
50 | column give the names of the files (located in
51 | \code{base_dir}) that contain the corresponding
52 | information - or, in the case of \code{data}, the
53 | directory containing the tables to be loaded.
54 | }
55 |
--------------------------------------------------------------------------------
/man/run_psa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/resamp_eval.R
3 | \name{run_psa}
4 | \alias{run_psa}
5 | \title{Run Probabilistic Uncertainty Analysis}
6 | \usage{
7 | run_psa(
8 | model,
9 | psa,
10 | N,
11 | resample,
12 | cores = 1,
13 | create_progress_reporter = create_null_prog_reporter,
14 | progress_reporter = create_progress_reporter(),
15 | simplify = F
16 | )
17 | }
18 | \arguments{
19 | \item{model}{The result of \code{\link[=run_model]{run_model()}}.}
20 |
21 | \item{psa}{Resampling distribution for parameters defined
22 | by \code{\link[=define_psa]{define_psa()}}.}
23 |
24 | \item{N}{Number of simulation to run.}
25 |
26 | \item{resample}{Deprecated. Resampling distribution for
27 | parameters defined by \code{\link[=define_psa]{define_psa()}}.}
28 | }
29 | \value{
30 | A list with one \code{data.frame} per model.
31 | }
32 | \description{
33 | Run Probabilistic Uncertainty Analysis
34 | }
35 | \examples{
36 | # example for run_psa
37 |
38 | mod1 <- define_strategy(
39 | transition = define_transition(
40 | .5, .5,
41 | .1, .9
42 | ),
43 | define_state(
44 | cost = cost_init + age * 5,
45 | ly = 1
46 | ),
47 | define_state(
48 | cost = cost_init + age,
49 | ly = 0
50 | )
51 | )
52 |
53 | mod2 <- define_strategy(
54 | transition = define_transition(
55 | p_trans, C,
56 | .1, .9
57 | ),
58 | define_state(
59 | cost = 789 * age / 10,
60 | ly = 1
61 | ),
62 | define_state(
63 | cost = 456 * age / 10,
64 | ly = 0
65 | )
66 |
67 | )
68 |
69 | res2 <- run_model(
70 | mod1, mod2,
71 | parameters = define_parameters(
72 | age_init = 60,
73 | cost_init = 1000,
74 | age = age_init + markov_cycle,
75 | p_trans = .7
76 | ),
77 | init = 1:0,
78 | cycles = 10,
79 | cost = cost,
80 | effect = ly
81 | )
82 |
83 | rsp <- define_psa(
84 | age_init ~ normal(60, 10),
85 | cost_init ~ normal(1000, 100),
86 | p_trans ~ binomial(.7, 100),
87 | correlation = matrix(c(
88 | 1, .4, 0,
89 | .4, 1, 0,
90 | 0, 0, 1
91 | ), byrow = TRUE, ncol = 3)
92 | )
93 |
94 |
95 | # with run_model result
96 | # (only 10 resample for speed)
97 | ndt1 <- run_psa(res2, psa = rsp, N = 10)
98 | }
99 |
--------------------------------------------------------------------------------
/man/safe_conversion.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{safe_conversion}
4 | \alias{safe_conversion}
5 | \alias{safe_convert}
6 | \alias{as_numeric_safe}
7 | \alias{as_integer_safe}
8 | \title{Safely Convert From Characters to Numbers}
9 | \usage{
10 | safe_convert(x, f)
11 |
12 | as_numeric_safe(x)
13 |
14 | as_integer_safe(x)
15 | }
16 | \arguments{
17 | \item{x}{A character vector.}
18 |
19 | \item{f}{A conversion function.}
20 | }
21 | \value{
22 | A converted vector.
23 | }
24 | \description{
25 | These function return an error if a conversion fails.
26 | }
27 | \keyword{internal}
28 |
--------------------------------------------------------------------------------
/man/save_outputs.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabular_input.R
3 | \name{save_outputs}
4 | \alias{save_outputs}
5 | \title{Save Model Outputs}
6 | \usage{
7 | save_outputs(outputs, output_dir, overwrite)
8 | }
9 | \arguments{
10 | \item{outputs}{Result from
11 | \code{\link[=run_model_tabular]{run_model_tabular()}}.}
12 |
13 | \item{output_dir}{Subdirectory in which to write output.}
14 |
15 | \item{overwrite}{Should the outputs be overwritten?}
16 | }
17 | \value{
18 | \code{NULL}. Used for its side effect of creating
19 | files in the output directory.
20 | }
21 | \description{
22 | Save Model Outputs
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/summary.run_model.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run_model_summary.R
3 | \name{summary.run_model}
4 | \alias{summary.run_model}
5 | \title{Summarise Markov Model Results}
6 | \usage{
7 | \method{summary}{run_model}(object, threshold = NULL, strategy_order = NULL, ...)
8 | }
9 | \arguments{
10 | \item{object}{Output from \code{\link[=run_model]{run_model()}}.}
11 |
12 | \item{threshold}{ICER threshold (possibly several) for
13 | net monetary benefit computation.}
14 |
15 | \item{...}{additional arguments affecting the summary
16 | produced.}
17 | }
18 | \value{
19 | A \code{summary_run_model} object.
20 | }
21 | \description{
22 | Summarise Markov Model Results
23 | }
24 |
--------------------------------------------------------------------------------
/man/summary.vbp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vbp_print.R
3 | \name{summary.vbp}
4 | \alias{summary.vbp}
5 | \title{Summarise Value-Based Pricing Results}
6 | \usage{
7 | \method{summary}{vbp}(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{Output from \code{\link[=run_vbp]{run_vbp()}}.}
11 |
12 | \item{...}{additional arguments affecting the summary
13 | produced.}
14 | }
15 | \value{
16 | A \code{summary_vbp} object.
17 | }
18 | \description{
19 | Summarise Value-Based Pricing Results
20 | }
21 |
--------------------------------------------------------------------------------
/man/who_mortality.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gho_mortality.R
3 | \name{who_mortality}
4 | \alias{who_mortality}
5 | \alias{get_who_mr_memo}
6 | \alias{get_who_mr}
7 | \title{Use WHO Mortality Rate}
8 | \usage{
9 | get_who_mr_memo(
10 | age,
11 | sex = NULL,
12 | region = NULL,
13 | country = NULL,
14 | year = "latest",
15 | local = FALSE
16 | )
17 |
18 | get_who_mr(
19 | age,
20 | sex = NULL,
21 | region = NULL,
22 | country = NULL,
23 | year = "latest",
24 | local = FALSE
25 | )
26 | }
27 | \arguments{
28 | \item{age}{age as a continuous variable.}
29 |
30 | \item{sex}{sex as \code{"FMLE"}-\code{"MLE"}, \code{0}-\code{1} (male = 0,
31 | female = 1) or \code{1}-\code{2} (male = 1, female = 2).}
32 |
33 | \item{region}{Region code. Assumed \code{NULL} if provided along
34 | with \code{country}.}
35 |
36 | \item{country}{Country code (see details).}
37 |
38 | \item{year}{Use data from that year. Defaults to
39 | \code{"latest"}.}
40 |
41 | \item{local}{Fetch mortality data from package cached
42 | data?}
43 | }
44 | \value{
45 | This function should be used within
46 | \code{\link[=define_transition]{define_transition()}} or \code{\link[=define_parameters]{define_parameters()}}.
47 | }
48 | \description{
49 | Returns age and sex-specific mortality probabilities for
50 | a given country.
51 | }
52 | \details{
53 | Locally cached data is used in case of connection
54 | problems, of if \code{local = TRUE}. For memory space reasons
55 | local data is only available for WHO high-income
56 | countries, and only for the latest year.
57 |
58 | The results of \code{get_who_mr} are memoised for
59 | \code{options("heRomod.memotime")} (default: 1 hour) to
60 | increase resampling performance.
61 | }
62 | \examples{
63 |
64 | define_transition(
65 | C, get_who_mr(age = 50 + markov_cycle, sex = "FMLE", country = "FRA"),
66 | 0, 1
67 | )
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/man/wtd_summary.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{wtd_summary}
4 | \alias{wtd_summary}
5 | \title{Weighted Summary}
6 | \usage{
7 | wtd_summary(x, weights = NULL)
8 | }
9 | \arguments{
10 | \item{x}{A numeric vector.}
11 |
12 | \item{weights}{A vector of weights, same length as
13 | \code{x}.}
14 | }
15 | \value{
16 | A vector with values \code{Min., 1st Qu., Median,
17 | Mean, 3rd Qu., Max.}.
18 | }
19 | \description{
20 | Compute a weighted summary of a numeric vector.
21 | }
22 | \details{
23 | If \code{weights} is \code{NULL} an unweighted summar is
24 | returned.
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.so
3 | *.dll
4 |
--------------------------------------------------------------------------------
/src/RcppExports-ed4ceba3.o.tmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/src/RcppExports-ed4ceba3.o.tmp
--------------------------------------------------------------------------------
/src/RcppExports.cpp:
--------------------------------------------------------------------------------
1 | // Generated by using Rcpp::compileAttributes() -> do not edit by hand
2 | // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3 |
4 | #include
5 |
6 | using namespace Rcpp;
7 |
8 | #ifdef RCPP_USE_GLOBAL_ROSTREAM
9 | Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10 | Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11 | #endif
12 |
13 | // cpp_convert_tables
14 | List cpp_convert_tables(List matrices, CharacterVector names);
15 | RcppExport SEXP _heRomod_cpp_convert_tables(SEXP matricesSEXP, SEXP namesSEXP) {
16 | BEGIN_RCPP
17 | Rcpp::RObject rcpp_result_gen;
18 | Rcpp::RNGScope rcpp_rngScope_gen;
19 | Rcpp::traits::input_parameter< List >::type matrices(matricesSEXP);
20 | Rcpp::traits::input_parameter< CharacterVector >::type names(namesSEXP);
21 | rcpp_result_gen = Rcpp::wrap(cpp_convert_tables(matrices, names));
22 | return rcpp_result_gen;
23 | END_RCPP
24 | }
25 |
26 | static const R_CallMethodDef CallEntries[] = {
27 | {"_heRomod_cpp_convert_tables", (DL_FUNC) &_heRomod_cpp_convert_tables, 2},
28 | {NULL, NULL, 0}
29 | };
30 |
31 | RcppExport void R_init_heRomod(DllInfo *dll) {
32 | R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
33 | R_useDynamicSymbols(dll, FALSE);
34 | }
35 |
--------------------------------------------------------------------------------
/src/code-3d31645c.o.tmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolicyAnalysisInc/heRoMod/c00f211de903878d1694e3e2cae2157b50951542/src/code-3d31645c.o.tmp
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(heRomod)
3 |
4 | ## the Sys.setenv fixes a problem running tests
5 | ## with parallel processing; related to
6 | ## https://github.com/hadley/testthat/issues/86 and
7 | ## https://github.com/hadley/testthat/issues/144
8 |
9 | Sys.setenv("R_TESTS" = "")
10 |
11 | test_check("heRomod")
12 |
--------------------------------------------------------------------------------
/tests/testthat/.gitignore:
--------------------------------------------------------------------------------
1 | *.pdf
2 |
--------------------------------------------------------------------------------
/tests/testthat/test_check_init.R:
--------------------------------------------------------------------------------
1 | context("Init checking")
2 |
3 | test_that(
4 | "check_init() works", {
5 | init1 <- define_init(a = 1, b = 0, c = 0)
6 | init2 <- c(a = 1, b = 0, c = 0)
7 | init2_bis <- c(a = 1, c = 0, b = 0)
8 | init3 <- c(1, 0, 0)
9 | init4 <- define_init(a = 1)
10 |
11 | ref <- letters[1:3]
12 |
13 | expect_identical(
14 | to_text_dots(check_init(init1, ref)),
15 | to_text_dots(check_init(init2, ref))
16 | )
17 |
18 | expect_identical(
19 | to_text_dots(check_init(init2, ref)),
20 | to_text_dots(check_init(init2_bis, ref))
21 | )
22 |
23 | expect_identical(
24 | to_text_dots(check_init(init1, ref)),
25 | to_text_dots(check_init(init3, ref))
26 | )
27 |
28 | expect_identical(
29 | to_text_dots(check_init(init1, ref)),
30 | to_text_dots(check_init(init4, ref))
31 | )
32 |
33 | expect_error(
34 | check_init(c(1, 0), ref)
35 | )
36 | expect_error(
37 | check_init(c(a = 1, b = 0, x = 0), ref)
38 | )
39 | expect_error(
40 | check_init(define_init(1, 0, 0), ref)
41 | )
42 | expect_error(
43 | check_init(define_init(1, 0), ref)
44 | )
45 | expect_error(
46 | check_init(define_init(a = 1, b = 0, x = 0), ref)
47 | )
48 | expect_error(
49 | check_init(define_init(a = 1, x = 0), ref)
50 | )
51 | expect_error(
52 | check_init(define_init(a = 1, a = 0), ref)
53 | )
54 | }
55 | )
56 |
--------------------------------------------------------------------------------
/tests/testthat/test_code_preview.R:
--------------------------------------------------------------------------------
1 |
2 | read_file_to_string <- function(path) {
3 | readChar(path, file.info(path)$size)
4 | }
5 |
6 |
7 | test_that("Code preivew generates appropriate HTML when a heading is included", {
8 | withr::with_dir(new = tempdir(), {
9 | run_markdown(
10 | text = "## # Foo \n mean(c(1,2,3,4,5))",
11 | data = list(),
12 | name = 'thetitle'
13 | )
14 | html <- read_file_to_string('thetitle.html')
15 |
16 | # Title tag is present and properly closed
17 | title_count <- stringr::str_count(
18 | html,
19 | stringr::fixed("thetitle.knit")
20 | )
21 | expect_equal(title_count, 1)
22 |
23 | # Heading is present exactly once
24 | heading_count <- stringr::str_count(
25 | html,
26 | stringr::fixed("Foo
")
27 | )
28 | expect_equal(heading_count, 1)
29 |
30 | # Code is present exactly once
31 | code_count <- stringr::str_count(
32 | html,
33 | stringr::fixed("mean(c(1,2,3,4,5))")
34 | )
35 | expect_equal(code_count, 1)
36 |
37 | # Result is present exactly once
38 | res_count <- stringr::str_count(
39 | html,
40 | stringr::fixed("[1] 3")
41 | )
42 | expect_equal(res_count, 1)
43 | })
44 | })
45 |
46 | test_that("Code preivew generates appropriate HTML when a heading is not included", {
47 | withr::with_dir(new = tempdir(), {
48 | run_markdown(
49 | text = "mean(c(1,2,3,4,5))",
50 | data = list(),
51 | name = 'thetitle'
52 | )
53 | html <- read_file_to_string('thetitle.html')
54 |
55 | # Title tag is present and properly closed
56 | title_count <- stringr::str_count(
57 | html,
58 | stringr::fixed("thetitle.knit")
59 | )
60 | expect_equal(title_count, 1)
61 |
62 | # No heading is present
63 | heading_count <- stringr::str_count(
64 | html,
65 | stringr::fixed("")
66 | )
67 | expect_equal(heading_count, 0)
68 |
69 | # Code is present exactly once
70 | code_count <- stringr::str_count(
71 | html,
72 | stringr::fixed("mean(c(1,2,3,4,5))")
73 | )
74 | expect_equal(code_count, 1)
75 |
76 | # Result is present exactly once
77 | res_count <- stringr::str_count(
78 | html,
79 | stringr::fixed("[1] 3")
80 | )
81 | expect_equal(res_count, 1)
82 | })
83 | })
--------------------------------------------------------------------------------
/tests/testthat/test_compat.R:
--------------------------------------------------------------------------------
1 | context("heRo3 compatability layer works")
2 |
3 | models_to_test <- tibble::tribble(
4 | ~name, ~filename,
5 | 'Advanced PSM', 'checkimab',
6 | 'Custom PSM', 'custompsm',
7 | 'PSM w/ Curve Fitting', 'fit',
8 | 'Markov w/ Groups', 'groups',
9 | 'Simple Markov', 'markov',
10 | 'Simple PSM', 'psm',
11 | 'TA447 PSM', 'ta447'
12 | )
13 |
14 | models_to_test %>%
15 | rowwise() %>%
16 | group_split() %>%
17 | purrr::walk(function(x) {
18 | do.call(test_model_convert, x)
19 | })
20 |
21 | test_that("Run Analysis works with converted model", {
22 | model <- jsonlite::read_json(
23 | system.file(
24 | "compat",
25 | paste0('psm', ".json"),
26 | package="heRomod"
27 | ),
28 | simplifyVector = T
29 | )
30 | model$analysis <- 'bc'
31 | expect_error({ expect_res <- do.call(run_analysis, model)}, NA)
32 | })
--------------------------------------------------------------------------------
/tests/testthat/test_hero.R:
--------------------------------------------------------------------------------
1 | context("Running heRo model")
2 |
3 | models_to_test <- tibble::tribble(
4 | ~name, ~path, ~bc, ~vbp, ~dsa, ~scen, ~psa, ~export, ~twsa,
5 | 'Simple PSM', 'example_simple_psm', T, T, T, F, T, T, F,
6 | 'Custom PSM', 'psm_responders', T, F, F, F, F, T, F,
7 | 'Groups Model', 'groups', T, T, T, T, T, T, T,
8 | 'Simple Markov Model', 'markov_model', T, T, T, T, T, T, T,
9 | 'Advanced Survival Modeling', 'advanced_surv_modeling', T, T, F, F, F, F, F,
10 | 'TA447 Replication', 'ta447', T, F, F, F, F, F, F,
11 | 'Shared State-Time', 'shared_st', T, F, F, F, F, F, F,
12 | 'Sparse Matrix', 'sparse', T, F, F, F, F, F, F
13 | )
14 |
15 | models_to_test %>%
16 | rowwise() %>%
17 | group_split() %>%
18 | purrr::walk(function(x) {
19 | do.call(test_model_results, x)
20 | })
21 |
--------------------------------------------------------------------------------
/tests/testthat/test_parallel.R:
--------------------------------------------------------------------------------
1 | context("Multiple cores")
2 |
3 | test_that(
4 | "Same results using 1 core or 2.", {
5 |
6 | library(parallel)
7 | result_1core <- run_model_tabular(
8 | location = system.file("tabular/thr", package = "heRomod"),
9 | save = FALSE, overwrite = FALSE, run_psa = FALSE
10 | )
11 |
12 | result_2core <- run_model_tabular(
13 | location = system.file("tabular/thr", package = "heRomod"),
14 | reference = "REFERENCE_2core.csv",
15 | save = FALSE, overwrite = FALSE, run_psa = FALSE
16 | )
17 | ## the objects contain environments, so we can't use identical;
18 | ## instead, we'll check parts that use multi-core processing
19 | ##
20 | ## parameters from the discrete sensitivity analysis
21 | expect_identical(
22 | sapply(result_1core$dsa$dsa$.par_value, lazyeval::lazy_eval),
23 | sapply(result_2core$dsa$dsa$.par_value, lazyeval::lazy_eval)
24 | )
25 | ## counts from all models from the discrete sensitivity analysis
26 | expect_identical(
27 | get_counts(get_model(result_1core$dsa)),
28 | get_counts(get_model(result_2core$dsa)))
29 | ## demographic analysis
30 | expect_equivalent(
31 | result_1core$demographics$updated_model[-3],
32 | result_2core$demographics$updated_model[-3])
33 | }
34 | )
35 |
--------------------------------------------------------------------------------
/tests/testthat/test_transform.R:
--------------------------------------------------------------------------------
1 | context("Transformation functions")
2 |
3 | # from http://www.hsrd.research.va.gov/for_researchers/cyber_seminars/archives/819-notes.pdf
4 | test_that(
5 | "Transformation functions produce correct results", {
6 | expect_equal(
7 | round(rescale_prob(.6, from = 3, to = 1), 2),
8 | .26
9 | )
10 | expect_equal(
11 | round(rescale_prob(.3, from = 5, to = 1), 4),
12 | .0689
13 | )
14 | expect_equal(
15 | round(rr_to_prob(2.37, .17), 3),
16 | .403
17 | )
18 | # https://en.wikipedia.org/wiki/Odds_ratio#Example
19 |
20 | expect_equal(
21 | round(or_to_prob(or = 36, .2), 2),
22 | .79
23 | )
24 | }
25 | )
26 |
27 | test_that(
28 | "Transformation functions fail when they should", {
29 | expect_error(rr_to_prob(2, .6))
30 | }
31 | )
32 |
--------------------------------------------------------------------------------
/vignettes/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 | *_files
3 |
--------------------------------------------------------------------------------
/vignettes/a_introduction.R:
--------------------------------------------------------------------------------
1 | ## ---- echo=FALSE, include=FALSE------------------------------------------
2 | library(heRomod)
3 |
4 | ## ------------------------------------------------------------------------
5 | mat_trans <- define_transition(
6 | .9, .1,
7 | .2, .8
8 | )
9 | mat_trans
10 |
11 | ## ------------------------------------------------------------------------
12 | state_A <- define_state(
13 | cost = 1234,
14 | utility = 0.85
15 | )
16 | state_A
17 |
18 | state_B <- define_state(
19 | cost = 4321,
20 | utility = 0.50
21 | )
22 | state_B
23 |
24 | ## ------------------------------------------------------------------------
25 | strat <- define_strategy(
26 | transition = mat_trans,
27 | state_A,
28 | state_B
29 | )
30 | strat
31 |
32 | ## ------------------------------------------------------------------------
33 | res_mod <- run_model(
34 | strat,
35 | cycles = 10,
36 | cost = cost,
37 | effect = utility
38 | )
39 | res_mod
40 |
41 | ## ---- fig.width = 6, fig.height=4, fig.align='center'--------------------
42 | plot(res_mod)
43 |
44 | ## ---- fig.align='center', fig.height=4, fig.width=6, message=FALSE-------
45 | library(ggplot2)
46 |
47 | plot(res_mod) +
48 | xlab("Time") +
49 | ylab("N") +
50 | theme_minimal() +
51 | scale_color_brewer(
52 | name = "State",
53 | palette = "Set1"
54 | )
55 |
56 | ## ---- fig.align='center', fig.height=4, fig.width=6, message=FALSE-------
57 | library(ggplot2)
58 |
59 | plot(res_mod, bw = TRUE)
60 |
61 | ## ------------------------------------------------------------------------
62 | head(get_counts(res_mod))
63 | head(get_values(res_mod))
64 |
65 | ## ------------------------------------------------------------------------
66 | rate_to_prob(r = 162, per = 1000, to = 5)
67 |
68 |
--------------------------------------------------------------------------------
/vignettes/b_time_dependency.R:
--------------------------------------------------------------------------------
1 | ## ---- echo=FALSE, include=FALSE------------------------------------------
2 | library(heRomod)
3 |
4 | ## ------------------------------------------------------------------------
5 | define_parameters(
6 | mr = exp(- state_time * lambda),
7 | age = 50 + model_time
8 | )
9 |
10 | define_state(
11 | cost = 100 - state_time,
12 | effect = 10
13 | )
14 |
15 | f <- function(x) abs(sin(x))
16 |
17 | define_transition(
18 | C, f(state_time),
19 | .1, .9
20 | )
21 |
22 |
--------------------------------------------------------------------------------
/vignettes/h_tabular.R:
--------------------------------------------------------------------------------
1 | ## ---- echo=FALSE, include=FALSE------------------------------------------
2 | library(heRomod)
3 | library(dplyr)
4 | format_na <- function(x, char = " ") {
5 | x[is.na(x)] <- char
6 | x
7 | }
8 |
9 | ## ----echo = FALSE--------------------------------------------------------
10 | heRomod:::read_file(system.file("tabular/thr/REFERENCE.csv", package = "heRomod")) %>%
11 | format_na %>%
12 | knitr::kable()
13 |
14 | ## ----echo = FALSE--------------------------------------------------------
15 | heRomod:::read_file(system.file("tabular/thr/THR_states.csv", package = "heRomod")) %>%
16 | format_na %>%
17 | knitr::kable()
18 |
19 | ## ----echo = FALSE--------------------------------------------------------
20 | heRomod:::read_file(system.file("tabular/thr/THR_transition_probs.csv", package = "heRomod")) %>%
21 | format_na %>%
22 | knitr::kable()
23 |
24 | ## ----echo = FALSE--------------------------------------------------------
25 | heRomod:::read_file(system.file("tabular/thr/THR_parameters.csv", package = "heRomod")) %>%
26 | format_na %>%
27 | knitr::kable()
28 |
29 | ## ----echo = FALSE--------------------------------------------------------
30 | heRomod:::read_file(system.file("tabular/thr/THR_options.csv", package = "heRomod")) %>%
31 | format_na %>%
32 | knitr::kable(row.names = FALSE)
33 |
34 | ## ------------------------------------------------------------------------
35 | result <- run_model_tabular(
36 | location = system.file("tabular/thr", package = "heRomod")
37 | )
38 |
39 | ## ---- fig.width = 6, fig.align='center'----------------------------------
40 | result$model_runs
41 | plot(result$psa,
42 | type = "ce")
43 | plot(result$dsa,
44 | result = "cost",
45 | strategy = "new")
46 | result$demographics
47 |
48 |
--------------------------------------------------------------------------------