├── .github ├── .gitignore └── workflows │ ├── pkgdown.yaml │ └── R-CMD-check.yaml ├── inst ├── tabular │ ├── thr │ │ ├── .gitignore │ │ ├── input_dataframes │ │ │ └── mr_table.xlsx │ │ ├── THR_options_2core.csv │ │ ├── THR_options.csv │ │ ├── THR_demographic_table.csv │ │ ├── THR_states.csv │ │ ├── REFERENCE_2core.csv │ │ ├── REFERENCE.csv │ │ ├── THR_transition_probs.csv │ │ └── THR_parameters.csv │ ├── test │ │ ├── .gitignore │ │ ├── wrong_ext.tab │ │ ├── THR_options.csv │ │ ├── testing_XLS_file_with_comment_col.xls │ │ ├── testing_XLSX_file_with_comment_col.xlsx │ │ ├── test_no_output_dir │ │ │ ├── THR_options.csv │ │ │ ├── input_dataframes │ │ │ │ └── mr_table.xlsx │ │ │ ├── THR_states.csv │ │ │ ├── REFERENCE.csv │ │ │ ├── THR_transition_probs.csv │ │ │ ├── THR_parameters.csv │ │ │ └── THR_demographic_table.csv │ │ ├── test_no_overwrite │ │ │ ├── THR_options.csv │ │ │ ├── input_dataframes │ │ │ │ └── mr_table.xlsx │ │ │ ├── output │ │ │ │ └── state_count_plot_standard.png │ │ │ ├── THR_states.csv │ │ │ ├── REFERENCE.csv │ │ │ ├── THR_transition_probs.csv │ │ │ ├── THR_parameters.csv │ │ │ └── THR_demographic_table.csv │ │ ├── example_multinom_params.csv │ │ ├── example_multinom_params_dup_name.csv │ │ ├── survival_spec_error_2.csv │ │ ├── THR_test_states.csv │ │ ├── survival_spec_error_1.csv │ │ ├── test_diff_mod_name │ │ │ ├── THR_states.csv │ │ │ ├── REFERENCE.csv │ │ │ └── THR_transition_probs.csv │ │ ├── survival_spec_1.csv │ │ ├── survival_spec_2.csv │ │ ├── testing_CSV_file_with_comment_col.csv │ │ ├── REFERENCE_missingfunctions.csv │ │ ├── REFERENCE_1probmissing.csv │ │ ├── toedit_REFERENCE.csv │ │ ├── THR_test_transition_probs_bad.csv │ │ ├── THR_test_transition_probs_2.csv │ │ ├── THR_test_transition_probs.csv │ │ ├── bad_REFERENCE.csv │ │ ├── THR_test_transition_probs_1missing.csv │ │ └── THR_parameters.csv │ └── surv │ │ ├── surv_table.csv │ │ ├── set_definitions_2.csv │ │ ├── use_fits.csv │ │ ├── example_oncOptions.csv │ │ ├── example_oncParams_nomatrix.csv │ │ ├── survival_data │ │ ├── OS.A.surv.fits.RData │ │ ├── OS.B.surv.fits.RData │ │ ├── PFS.A.surv.fits.RData │ │ ├── PFS.B.surv.fits.RData │ │ ├── set_definitions.csv │ │ └── set_def_pfs_os.csv │ │ ├── use_fits_example0.csv │ │ ├── use_fits_mixed.csv │ │ ├── example_oncSpecs_nomatrix_run.csv │ │ ├── set_definitions_1.csv │ │ ├── set_definitions_error_1.csv │ │ ├── survival_info_explicit_dists.csv │ │ ├── example_oncSpecs_nomatrix.csv │ │ ├── example_oncSpecs_mixed.csv │ │ ├── example_oncSpecs_test_part_surv.csv │ │ ├── surv_def_ok.csv │ │ ├── example_oncSpecs_nomatrix_join.csv │ │ ├── survival_info_nomatrix_run.csv │ │ ├── example_oncSpecs.csv │ │ ├── example_oncSpecs_explicit_dists.csv │ │ ├── use_fits_join.csv │ │ ├── example_use_fits_explicit_dists.csv │ │ ├── example_oncStates.csv │ │ ├── survival_info.csv │ │ ├── survival_info_eventcode_error.csv │ │ ├── example_oncTransitionProbs.csv │ │ ├── example_oncParams.csv │ │ ├── survival_info_eventcode.csv │ │ ├── example_oncParams_explicit_dists.csv │ │ └── fake_fit_tib.csv ├── media │ └── logo.png ├── examples │ ├── example_define_state.R │ ├── example_eval_parameters.R │ ├── example_define_calibration_fn.R │ ├── example_define_strategy.R │ ├── example_define_resample.R │ ├── example_transform.R │ ├── example_eval_strategy.R │ ├── example_eval_strategy_newdata.R │ ├── example_plot.run_model.R │ ├── example_calibration.R │ ├── example_define_transition.R │ ├── example_run_model.R │ ├── example_plot.surv_object.R │ ├── example_define_parameters.R │ ├── example_run_dsa.R │ ├── example_look_up.R │ ├── example_run_psa.R │ └── example_update.R └── CITATION ├── tests ├── testthat │ ├── .gitignore │ ├── setup.R │ ├── test_transform.R │ ├── test_parallel.R │ └── test_check_init.R └── testthat.R ├── vignettes └── .gitignore ├── R ├── sysdata.rda ├── param_print.R ├── zzz.R ├── correct_counts.R └── states_print.R ├── _pkgdown.yml ├── docs ├── reference │ ├── Rplot001.png │ ├── Rplot002.png │ ├── distributions-1.png │ ├── define_transition-1.png │ ├── plot.surv_object-1.png │ └── plot.surv_object-2.png ├── articles │ ├── h_tabular_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-8-1.png │ │ │ └── unnamed-chunk-8-2.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── j_survival_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-11-1.png │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-2-2.png │ │ │ ├── unnamed-chunk-3-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ └── unnamed-chunk-9-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── a_introduction_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ └── unnamed-chunk-8-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── c_homogeneous_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-13-1.png │ │ │ ├── unnamed-chunk-14-1.png │ │ │ ├── unnamed-chunk-15-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ └── unnamed-chunk-5-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── f_sensitivity_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ ├── unnamed-chunk-8-1.png │ │ │ ├── unnamed-chunk-8-2.png │ │ │ └── unnamed-chunk-9-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── e_probabilistic_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-10-2.png │ │ │ ├── unnamed-chunk-11-1.png │ │ │ ├── unnamed-chunk-12-1.png │ │ │ ├── unnamed-chunk-13-1.png │ │ │ ├── unnamed-chunk-14-1.png │ │ │ └── unnamed-chunk-9-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── g_heterogeneity_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ ├── unnamed-chunk-7-2.png │ │ │ ├── unnamed-chunk-8-1.png │ │ │ ├── unnamed-chunk-8-2.png │ │ │ ├── unnamed-chunk-8-3.png │ │ │ ├── unnamed-chunk-9-1.png │ │ │ ├── unnamed-chunk-9-2.png │ │ │ └── unnamed-chunk-9-3.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── j_survival_2_psa_files │ │ └── figure-html │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-2-2.png │ │ │ ├── unnamed-chunk-3-1.png │ │ │ └── unnamed-chunk-4-1.png │ ├── d_non_homogeneous_files │ │ ├── figure-html │ │ │ ├── unnamed-chunk-4-1.png │ │ │ └── unnamed-chunk-8-1.png │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── b_time_dependency_files │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── i_reproduction_files │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ └── k_calibration_files │ │ ├── anchor-sections-1.0 │ │ ├── anchor-sections.css │ │ └── anchor-sections.js │ │ └── accessible-code-block-0.0.1 │ │ └── empty-anchor.js ├── pkgdown.yml └── link.svg ├── .gitignore ├── cran-comments.md ├── man ├── plur.Rd ├── list_all_same.Rd ├── clean_factors.Rd ├── read_file.Rd ├── get_parameter_names.Rd ├── as_expr_list.Rd ├── reexports.Rd ├── get_frontier.Rd ├── get_state_value_names.Rd ├── file-checkers.Rd ├── check_states.Rd ├── reindent_transition.Rd ├── create_options_from_tabular.Rd ├── is.wholenumber.Rd ├── make_names.Rd ├── get_state_number.Rd ├── calc_surv_from_prob.Rd ├── get_state_names.Rd ├── get_transition.Rd ├── get_mat_total.Rd ├── calc_prob_from_surv.Rd ├── check_names.Rd ├── get_matrix_order.Rd ├── eval_resample.Rd ├── create_model_list_from_tabular.Rd ├── filter_blanks.Rd ├── extract_strata.Rd ├── modify.Rd ├── run_bcea.Rd ├── check_cycle_inputs.Rd ├── check_strategy_index.Rd ├── define_init.Rd ├── define_inflow.Rd ├── safe_conversion.Rd ├── wtd_summary.Rd ├── combine_probs.Rd ├── summary.surv_shift.Rd ├── save_outputs.Rd ├── check_matrix.Rd ├── summary.run_model.Rd ├── discount_hack.Rd ├── extract_stratum.Rd ├── apply_hr.Rd ├── insert.Rd ├── apply_or.Rd ├── create_demographic_table.Rd ├── define_surv_fit.Rd ├── compute_values.Rd ├── eval_state_list.Rd ├── project_fn.Rd ├── apply_af.Rd ├── load_surv_models.Rd ├── extract_params.Rd ├── dispatch_strategy.Rd ├── eval_transition.Rd ├── compute_icer.Rd ├── resample_surv.Rd ├── dispatch_strategy_hack.Rd ├── export_savi.Rd ├── create_df_from_tabular.Rd ├── add_hazards.Rd ├── get_counts_diff.Rd ├── combine_models.Rd ├── acceptability_curve.Rd ├── define_dsa.Rd ├── define_surv_dist.Rd ├── eval_parameters.Rd ├── mix.Rd ├── define_surv_table.Rd ├── create_model_from_tabular.Rd ├── apply_shift.Rd ├── gather_model_info.Rd ├── compute_surv.Rd ├── join.Rd ├── define_correlation.Rd ├── get_values.Rd ├── get_counts.Rd ├── create_parameters_from_tabular.Rd ├── rescale_discount_rate.Rd ├── heemod_scale.Rd ├── part_survs_from_surv_inputs.Rd ├── define_surv_spline.Rd ├── interpolate.Rd ├── who_mortality.Rd ├── heemod-package.Rd ├── eval_models_from_tabular.Rd ├── expand_state.Rd ├── discount.Rd ├── define_starting_values.Rd ├── compute_counts.Rd ├── define_calibration_fn.Rd ├── parse_multi_spec.Rd ├── construct_part_surv_tib.Rd ├── set_covariates.Rd ├── define_state.Rd ├── create_matrix_from_tabular.Rd ├── plot.psa.Rd ├── cluster.Rd ├── probability.Rd ├── define_state_list.Rd ├── create_states_from_tabular.Rd ├── eval_strategy_newdata.Rd ├── run_model_tabular.Rd ├── run_dsa.Rd └── define_psa.Rd ├── .Rbuildignore └── heemod.Rproj /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /inst/tabular/thr/.gitignore: -------------------------------------------------------------------------------- 1 | output -------------------------------------------------------------------------------- /tests/testthat/.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *_files 3 | -------------------------------------------------------------------------------- /inst/tabular/test/.gitignore: -------------------------------------------------------------------------------- 1 | edited_ref.csv 2 | -------------------------------------------------------------------------------- /inst/tabular/test/wrong_ext.tab: -------------------------------------------------------------------------------- 1 | col1 col2 2 | 1 2 3 | 3 4 -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/R/sysdata.rda -------------------------------------------------------------------------------- /inst/media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/media/logo.png -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(heemod) 3 | 4 | test_check("heemod") 5 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://aphp.github.io/heemod/ 2 | template: 3 | bootstrap: 5 4 | 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /inst/tabular/surv/set_definitions_2.csv: -------------------------------------------------------------------------------- 1 | treatment,set_name,condition 2 | fake_treatment,all,TRUE 3 | -------------------------------------------------------------------------------- /inst/examples/example_define_state.R: -------------------------------------------------------------------------------- 1 | st <- define_state( 2 | cost = 6453, 3 | utility = .876 4 | ) 5 | st 6 | -------------------------------------------------------------------------------- /docs/reference/distributions-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/distributions-1.png -------------------------------------------------------------------------------- /tests/testthat/setup.R: -------------------------------------------------------------------------------- 1 | file.copy(system.file( 2 | "tabular", package = "heemod"), 3 | tempdir(), recursive=TRUE) -------------------------------------------------------------------------------- /docs/reference/define_transition-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/define_transition-1.png -------------------------------------------------------------------------------- /docs/reference/plot.surv_object-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/plot.surv_object-1.png -------------------------------------------------------------------------------- /docs/reference/plot.surv_object-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/reference/plot.surv_object-2.png -------------------------------------------------------------------------------- /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/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/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_nomatrix.csv: -------------------------------------------------------------------------------- 1 | parameter,value 2 | km_until,0 3 | , 4 | utility.dr,0.000671233 5 | cost.dr,0.000671233 6 | -------------------------------------------------------------------------------- /inst/tabular/thr/input_dataframes/mr_table.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/thr/input_dataframes/mr_table.xlsx -------------------------------------------------------------------------------- /inst/tabular/surv/survival_data/OS.A.surv.fits.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/surv/survival_data/OS.A.surv.fits.RData -------------------------------------------------------------------------------- /inst/tabular/surv/survival_data/OS.B.surv.fits.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/surv/survival_data/OS.B.surv.fits.RData -------------------------------------------------------------------------------- /inst/tabular/surv/survival_data/PFS.A.surv.fits.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/surv/survival_data/PFS.A.surv.fits.RData -------------------------------------------------------------------------------- /inst/tabular/surv/survival_data/PFS.B.surv.fits.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/surv/survival_data/PFS.B.surv.fits.RData -------------------------------------------------------------------------------- /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/thr/THR_options_2core.csv: -------------------------------------------------------------------------------- 1 | option,value 2 | cost,cost 3 | effect,qaly 4 | , 5 | method,beginning 6 | cycles,50 7 | n,100 8 | num_cores,2 9 | -------------------------------------------------------------------------------- /inst/tabular/test/testing_XLS_file_with_comment_col.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/test/testing_XLS_file_with_comment_col.xls -------------------------------------------------------------------------------- /inst/tabular/thr/THR_options.csv: -------------------------------------------------------------------------------- 1 | option,value 2 | cost,cost 3 | effect,qaly 4 | , 5 | method,beginning 6 | cycles,50 7 | n,10 8 | init,"1000, 0, 0, 0, 0" 9 | -------------------------------------------------------------------------------- /inst/tabular/test/testing_XLSX_file_with_comment_col.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/test/testing_XLSX_file_with_comment_col.xlsx -------------------------------------------------------------------------------- /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_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" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | README.html 5 | doc 6 | Meta 7 | /doc/ 8 | /Meta/ 9 | /autre/ 10 | docs 11 | .Rprofile 12 | packrat/lib*/ 13 | -------------------------------------------------------------------------------- /docs/articles/h_tabular_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/h_tabular_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/h_tabular_files/figure-html/unnamed-chunk-8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/h_tabular_files/figure-html/unnamed-chunk-8-2.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/a_introduction_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/a_introduction_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/a_introduction_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/c_homogeneous_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-8-2.png -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/f_sensitivity_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /inst/tabular/test/test_no_output_dir/input_dataframes/mr_table.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/test/test_no_output_dir/input_dataframes/mr_table.xlsx -------------------------------------------------------------------------------- /inst/tabular/test/test_no_overwrite/input_dataframes/mr_table.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/test/test_no_overwrite/input_dataframes/mr_table.xlsx -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local ubuntu 24.04 install, R 4.4.1 3 | * github actions() 4 | 5 | ## R CMD check results 6 | 7 | 8 | There were no ERRORs, WARNINGs or NOTES -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-10-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-10-2.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/e_probabilistic_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-7-2.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-2.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-8-3.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-2.png -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/g_heterogeneity_files/figure-html/unnamed-chunk-9-3.png -------------------------------------------------------------------------------- /docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/j_survival_2_psa_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /inst/examples/example_eval_parameters.R: -------------------------------------------------------------------------------- 1 | param <- define_parameters( 2 | age_start = 60, 3 | age = age_start + model_time 4 | ) 5 | 6 | heemod:::eval_parameters(param, cycles = 15) 7 | -------------------------------------------------------------------------------- /docs/articles/d_non_homogeneous_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/d_non_homogeneous_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/d_non_homogeneous_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/docs/articles/d_non_homogeneous_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /inst/tabular/surv/use_fits_mixed.csv: -------------------------------------------------------------------------------- 1 | .strategy,.type,dist 2 | A,pfs,"define_surv_dist(distribution = ""exp"", rate = 1/100)" 3 | A,os,fit('exp') 4 | B,pfs,fit('exp') 5 | B,os,fit('exp') 6 | -------------------------------------------------------------------------------- /inst/tabular/test/test_no_overwrite/output/state_count_plot_standard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aphp/heemod/HEAD/inst/tabular/test/test_no_overwrite/output/state_count_plot_standard.png -------------------------------------------------------------------------------- /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/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/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/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_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/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/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/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 | -------------------------------------------------------------------------------- /R/param_print.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | print.uneval_parameters <- function(x, ...) { 3 | cat(sprintf("%i unevaluated parameter%s.\n\n", 4 | length(x), plur(length(x)))) 5 | res <- to_text_dots(x) 6 | cat(res, sep = "\n") 7 | } 8 | -------------------------------------------------------------------------------- /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_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_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/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/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/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/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/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/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/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 | -------------------------------------------------------------------------------- /docs/articles/h_tabular_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/j_survival_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/b_time_dependency_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/d_non_homogeneous_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/i_reproduction_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/k_calibration_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /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/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/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_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_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/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/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/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/tabular/surv/example_use_fits_explicit_dists.csv: -------------------------------------------------------------------------------- 1 | .strategy,.type,dist 2 | A,pfs,"define_surv_dist(distribution = ""exp"", rate = 0.0338)" 3 | A,os,"define_surv_dist(distribution = ""exp"", rate = 0.0151)" 4 | B,pfs,"define_surv_dist(distribution = ""exp"", rate = 0.0483)" 5 | B,os,"define_surv_dist(distribution = ""exp"", rate = 0.0215)" 6 | -------------------------------------------------------------------------------- /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/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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^cran-comments\.md$ 2 | ^CRAN-RELEASE$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^\.git 6 | ^\.travis\.yml$ 7 | ^NEWS\.html$ 8 | ^README\.html$ 9 | ^vignettes/.*\.html$ 10 | ^vignettes/.*\.md$ 11 | ^codecov\.yml$ 12 | ^data-raw$ 13 | ^docs$ 14 | ^_pkgdown\.yml$ 15 | ^doc$ 16 | ^Meta$ 17 | ^CRAN-SUBMISSION$ 18 | ^LICENSE\.md$ 19 | ^\.github$ 20 | ^revdep$ 21 | ^pkgdown$ 22 | ^packrat/ 23 | ^\.Rprofile$ 24 | -------------------------------------------------------------------------------- /heemod.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch 18 | PackageCheckArgs: --as-cran 19 | PackageRoxygenize: rd,collate,namespace 20 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 quosures 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/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/heemod.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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | \value{ 13 | A character vector of state value names. 14 | } 15 | \description{ 16 | Return Names of State Values 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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) 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/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 whole Numbers} 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 whole Numbers 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_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 | -------------------------------------------------------------------------------- /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/calc_surv_from_prob.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{calc_surv_from_prob} 4 | \alias{calc_surv_from_prob} 5 | \title{Calculate Probability of Survival} 6 | \usage{ 7 | calc_surv_from_prob(x) 8 | } 9 | \arguments{ 10 | \item{x}{A vector of per-cycle event probabilities.} 11 | } 12 | \value{ 13 | The survival probabilities. 14 | } 15 | \description{ 16 | Calculates the probability of survival from a vector of 17 | event probabilities 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /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_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_mat_total.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_mat_total} 4 | \alias{get_mat_total} 5 | \title{Get count number} 6 | \usage{ 7 | get_mat_total(x, init) 8 | } 9 | \arguments{ 10 | \item{x}{transition matrix} 11 | 12 | \item{init}{numeric vector, same length as number of 13 | model states. Number of individuals in each model state 14 | at the beginning.} 15 | } 16 | \value{ 17 | A count matrix 18 | } 19 | \description{ 20 | Get count number 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/calc_prob_from_surv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{calc_prob_from_surv} 4 | \alias{calc_prob_from_surv} 5 | \title{Calculate Probability of Event} 6 | \usage{ 7 | calc_prob_from_surv(x) 8 | } 9 | \arguments{ 10 | \item{x}{A vector of conditional event probabilities.} 11 | } 12 | \value{ 13 | The per-cycle event probabilities. 14 | } 15 | \description{ 16 | Calculates the per-cycle event probabilities from a 17 | vector of survival probabilities. 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onLoad <- function(libname, pkgname) { 2 | op <- options() 3 | op.heemod <- list( 4 | heemod.verbose = FALSE, 5 | heemod.memotime = 3600, 6 | heemod.inf_parameter = "stop" 7 | ) 8 | toset <- !(names(op.heemod) %in% names(op)) 9 | if(any(toset)) options(op.heemod[toset]) 10 | 11 | invisible() 12 | } 13 | 14 | .onAttach <- function(libname, pkgname) { 15 | options("heemod.env" = rlang::new_environment(parent = asNamespace("heemod"))) 16 | assign("start_tibble", data.frame(), getOption("heemod.env")) 17 | invisible() 18 | } 19 | 20 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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{model_time} and anything 21 | starting with \code{.}. 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /inst/examples/example_eval_strategy.R: -------------------------------------------------------------------------------- 1 | param <- define_parameters( 2 | a = model_time + 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 | heemod:::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/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/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/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 | -------------------------------------------------------------------------------- /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) 8 | } 9 | \arguments{ 10 | \item{psa}{A \code{\link[=define_psa]{define_psa()}} object.} 11 | 12 | \item{N}{> 0. 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 | -------------------------------------------------------------------------------- /inst/examples/example_eval_strategy_newdata.R: -------------------------------------------------------------------------------- 1 | par1 <- define_parameters( 2 | a = 1, 3 | b = 1 / (model_time + 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 * model_time) 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 | heemod:::eval_strategy_newdata( 29 | res1, 30 | newdata = new_tab 31 | ) 32 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/extract_strata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{extract_strata} 4 | \alias{extract_strata} 5 | \title{Extract Product-Limit Tables} 6 | \usage{ 7 | extract_strata(sf) 8 | } 9 | \arguments{ 10 | \item{sf}{A survfit object.} 11 | } 12 | \value{ 13 | A tidy data.frame of the product-limit tables for 14 | all strata. 15 | } 16 | \description{ 17 | Extracts the product-limit table from a survfit object 18 | for all strata. Only \code{survfit} and unstratified 19 | \code{survfit.coxph} objects are supported. 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.0.7 3 | pkgdown_sha: ~ 4 | articles: 5 | a_introduction: a_introduction.html 6 | b_time_dependency: b_time_dependency.html 7 | c_homogeneous: c_homogeneous.html 8 | d_non_homogeneous: d_non_homogeneous.html 9 | e_probabilistic: e_probabilistic.html 10 | f_sensitivity: f_sensitivity.html 11 | g_heterogeneity: g_heterogeneity.html 12 | h_tabular: h_tabular.html 13 | i_reproduction: i_reproduction.html 14 | j_survival: j_survival.html 15 | j_survival_2_psa: j_survival_2_psa.html 16 | k_calibration: k_calibration.html 17 | last_built: 2023-09-12T13:25Z 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 arguments 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/check_cycle_inputs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{check_cycle_inputs} 4 | \alias{check_cycle_inputs} 5 | \title{Check Cycle and Time Inputs} 6 | \usage{ 7 | check_cycle_inputs(cycle, cycle_length) 8 | } 9 | \arguments{ 10 | \item{cycle}{The \code{model_time} or \code{state_time} for which 11 | to predict.} 12 | 13 | \item{cycle_length}{The length of a Markov cycle in 14 | absolute time units.} 15 | } 16 | \description{ 17 | Performs checks on the cycle and time inputs to 18 | \code{\link[=eval_surv]{eval_surv()}}. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 = "heemod")`. 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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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, model_time = model_time, markov_cycle_length = 1, pred_type = ""prob"")" 4 | os.tr.A,"get_surv_probs(OS.fit, ""A"", km_until = km_until, model_time = model_time, markov_cycle_length = 1, pred_type = ""prob"")" 5 | pfs.tr.B,"get_surv_probs(PFS.fit, ""B"", km_until = km_until, model_time = model_time, markov_cycle_length = 1, pred_type = ""prob"")" 6 | os.tr.B,"get_surv_probs(OS.fit, ""B"", km_until = km_until, model_time = model_time, markov_cycle_length = 1, pred_type = ""prob"")" 7 | utility.dr,0.000671233 8 | cost.dr,0.000671233 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | bibentry( 2 | bibtype = "article", 3 | author = c( 4 | person("Antoine", "Filipovi\\'c-Pierucci"), 5 | person("Kevin", "Zarca"), 6 | person("Isabelle", "Durand-Zaleski") 7 | ), 8 | title = "Markov Models for Health Economic Evaluation: The R Package heemod", 9 | journal = "ArXiv e-prints", 10 | archivePrefix = "arXiv", 11 | primaryClass = "stat.AP", 12 | year = "2017", 13 | eprint = "1702.03252", 14 | note = sprintf("R package version %s", meta$Version), 15 | month = "feb", 16 | adsurl = "https://adsabs.harvard.edu/abs/2017arXiv170203252F", 17 | adsnote = "Provided by the SAO/NASA Astrophysics Data System" 18 | ) 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 summary is 24 | returned. 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /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/summary.surv_shift.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{summary.surv_shift} 4 | \alias{summary.surv_shift} 5 | \title{Summarize surv_shift objects} 6 | \usage{ 7 | \method{summary}{surv_shift}(object, summary_type = c("plot", "standard"), ...) 8 | } 9 | \arguments{ 10 | \item{object}{a \code{surv_shift} object} 11 | 12 | \item{summary_type}{"standard" or "plot" - "standard" 13 | for the usual summary of a \code{survfit} object, 14 | "plot" for a fuller version} 15 | 16 | \item{...}{other arguments} 17 | } 18 | \value{ 19 | A summary. 20 | } 21 | \description{ 22 | Summarize surv_shift objects 23 | } 24 | -------------------------------------------------------------------------------- /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/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 fulfills 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/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, ...) 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/discount_hack.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/states_eval.R 3 | \name{discount_hack} 4 | \alias{discount_hack} 5 | \title{Hack to Work Around a Discounting Issue} 6 | \usage{ 7 | discount_hack(.dots) 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, dplyr::n()))} to 22 | ensure \code{x} is recycled to the correct length. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/extract_stratum.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{extract_stratum} 4 | \alias{extract_stratum} 5 | \title{Extract Product-Limit Table for a Stratum} 6 | \usage{ 7 | extract_stratum(sf, index) 8 | } 9 | \arguments{ 10 | \item{sf}{A survfit object.} 11 | 12 | \item{index}{The index number of the strata to extract.} 13 | } 14 | \value{ 15 | A data frame of the product-limit table for the 16 | given stratum. 17 | } 18 | \description{ 19 | Extracts the product-limit table from a survfit object 20 | for a given stratum. Only \code{\link[survival:survfit]{survival::survfit()}} objects are 21 | supported. 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/apply_hr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{apply_hr} 4 | \alias{apply_hr} 5 | \title{Apply a Hazard Ratio} 6 | \usage{ 7 | apply_hr(dist, hr, log_hr = FALSE) 8 | } 9 | \arguments{ 10 | \item{dist}{A survival distribution.} 11 | 12 | \item{hr}{A hazard ratio to be applied.} 13 | 14 | \item{log_hr}{If \code{TRUE}, the hazard ratio is exponentiated 15 | before being applied.} 16 | } 17 | \value{ 18 | A \code{surv_ph} object. 19 | } 20 | \description{ 21 | Proportional reduce or increase the hazard rate of a 22 | distribution. 23 | } 24 | \examples{ 25 | 26 | dist1 <- define_surv_dist(distribution = "exp", rate = .25) 27 | ph_dist <- apply_hr(dist1, 0.5) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /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 | heemod:::insert(letters, c(0, 5, 26), c("xxx", "yyy")) 31 | 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/apply_or.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{apply_or} 4 | \alias{apply_or} 5 | \title{Apply an Odds Ratio} 6 | \usage{ 7 | apply_or(dist, or, log_or = FALSE) 8 | } 9 | \arguments{ 10 | \item{dist}{A survival distribution.} 11 | 12 | \item{or}{An odds ratio to be applied.} 13 | 14 | \item{log_or}{If \code{TRUE}, the odds ratio is exponentiated 15 | before being applied.} 16 | } 17 | \value{ 18 | A \code{surv_po} object. 19 | } 20 | \description{ 21 | Proportionally increase or reduce the odds of an event of 22 | a survival distribution. 23 | } 24 | \examples{ 25 | 26 | dist1 <- define_surv_dist(distribution = "exp", rate = .25) 27 | po_dist <- apply_or(dist1, 1.2) 28 | } 29 | -------------------------------------------------------------------------------- /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 | \value{ 17 | A data frame. 18 | } 19 | \description{ 20 | This function mostly checks whether the parameters are 21 | correct. 22 | } 23 | \details{ 24 | An optional \code{.weights} column can exist in the file. 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/define_surv_fit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_define.R 3 | \name{define_surv_fit} 4 | \alias{define_surv_fit} 5 | \title{Define a Fitted Survival Model} 6 | \usage{ 7 | define_surv_fit(x) 8 | } 9 | \arguments{ 10 | \item{x}{a survfit or flexsurvreg object} 11 | } 12 | \value{ 13 | A \code{surv_object} object. 14 | } 15 | \description{ 16 | Define a fitted survival models with a Kaplan-Meier estimator or 17 | parametric distributions 18 | } 19 | \examples{ 20 | 21 | library(survival) 22 | 23 | define_surv_fit( 24 | survfit(Surv(time, status) ~ 1, data = colon) 25 | ) 26 | 27 | define_surv_fit( 28 | flexsurv::flexsurvreg(Surv(time, status) ~ 1, data = colon, dist = "exp") 29 | ) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /docs/articles/h_tabular_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/j_survival_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /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, count_list, strategy_starting_values) 8 | } 9 | \arguments{ 10 | \item{states}{An object of class \code{eval_state_list}.} 11 | 12 | \item{count_list}{An object of class \code{cycle_counts}.} 13 | 14 | \item{strategy_starting_values}{An object of class \code{uneval_starting_values}} 15 | } 16 | \value{ 17 | A data.frame of state values, one column per 18 | state value and one row per cycle. 19 | } 20 | \description{ 21 | Given states and counts, computes the total state values 22 | per cycle. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /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) 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 | \value{ 17 | An \code{eval_states} object, a list with one 18 | data.frame per state containing a column per state 19 | value and a line per cycle. 20 | } 21 | \description{ 22 | Evaluate Markov Model States 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/project_fn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{project_fn} 4 | \alias{project_fn} 5 | \title{Project Beyond a Survival Distribution with Another 6 | (pairwise)} 7 | \usage{ 8 | project_fn(dist1, dist2_list) 9 | } 10 | \arguments{ 11 | \item{dist1}{Survival distribution to project from.} 12 | 13 | \item{dist2_list}{A list containing distribution to 14 | project with and the time at which projection begins.} 15 | } 16 | \value{ 17 | A \code{surv_projection} object. 18 | } 19 | \description{ 20 | Project survival from a survival distribution using 21 | another survival distribution at the specified cutpoint. 22 | Used by project to reduce the list of distributions. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/i_reproduction_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/k_calibration_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /man/apply_af.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{apply_af} 4 | \alias{apply_af} 5 | \title{Apply an Acceleration Factor} 6 | \usage{ 7 | apply_af(dist, af, log_af = FALSE) 8 | } 9 | \arguments{ 10 | \item{dist}{A survival distribution.} 11 | 12 | \item{af}{An acceleration factor to be applied.} 13 | 14 | \item{log_af}{If \code{TRUE}, the acceleration factor is 15 | exponentiated before being applied.} 16 | } 17 | \value{ 18 | A \code{surv_aft} object. 19 | } 20 | \description{ 21 | Proportionally increase or reduce the time to event of a 22 | survival distribution. 23 | } 24 | \examples{ 25 | 26 | dist1 <- define_surv_dist(distribution = "exp", rate = .25) 27 | aft_dist <- apply_af(dist1, 1.5) 28 | } 29 | -------------------------------------------------------------------------------- /docs/articles/b_time_dependency_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/d_non_homogeneous_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /man/load_surv_models.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tabular_input.R 3 | \name{load_surv_models} 4 | \alias{load_surv_models} 5 | \title{Load a set of survival fits} 6 | \usage{ 7 | load_surv_models(location, survival_specs, use_envir) 8 | } 9 | \arguments{ 10 | \item{location}{base directory} 11 | 12 | \item{survival_specs}{information about fits} 13 | 14 | \item{use_envir}{an environment} 15 | } 16 | \value{ 17 | A list with two elements: \itemize{ 18 | \item{\code{best_models}, 19 | a list with the fits for each data file passed in; and} 20 | \item{\code{envir}, 21 | an environment containing the models so they can be referenced to 22 | get probabilities.} 23 | } 24 | } 25 | \description{ 26 | Load a set of survival fits 27 | } 28 | -------------------------------------------------------------------------------- /man/extract_params.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{extract_params} 4 | \alias{extract_params} 5 | \title{Extract Evaluated Parameters} 6 | \usage{ 7 | extract_params(obj, data = NULL) 8 | } 9 | \arguments{ 10 | \item{obj}{A \code{\link[flexsurv:flexsurvreg]{flexsurv::flexsurvreg()}} object.} 11 | 12 | \item{data}{An optional dataset of covariate values to 13 | generate parameters for. Defaults to the original data 14 | to which the model was fit.} 15 | } 16 | \value{ 17 | A tidy data frame of curve parameters for each 18 | covariate level. 19 | } 20 | \description{ 21 | Extracts the covariate-adjusted parameters from a 22 | \code{\link[flexsurv:flexsurvreg]{flexsurv::flexsurvreg()}} object. 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /tests/testthat/test_transform.R: -------------------------------------------------------------------------------- 1 | # from https://www.hsrd.research.va.gov/for_researchers/cyber_seminars/archives/819-notes.pdf 2 | test_that( 3 | "Transformation functions produce correct results", { 4 | expect_equal( 5 | round(rescale_prob(.6, from = 3, to = 1), 2), 6 | .26 7 | ) 8 | expect_equal( 9 | round(rescale_prob(.3, from = 5, to = 1), 4), 10 | .0689 11 | ) 12 | expect_equal( 13 | round(rr_to_prob(2.37, .17), 3), 14 | .403 15 | ) 16 | # https://en.wikipedia.org/wiki/Odds_ratio#Example 17 | 18 | expect_equal( 19 | round(or_to_prob(or = 36, .2), 2), 20 | .9 21 | ) 22 | } 23 | ) 24 | 25 | test_that( 26 | "Transformation functions fail when they should", { 27 | expect_error(rr_to_prob(2, .6)) 28 | } 29 | ) 30 | -------------------------------------------------------------------------------- /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 implicitely 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 + model_time 30 | ) 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /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, parameters) 8 | } 9 | \arguments{ 10 | \item{x}{an \code{uneval_matrix} object.} 11 | 12 | \item{parameters}{an \code{eval_parameters} object.} 13 | } 14 | \value{ 15 | An \code{eval_matrix} object (actually a list of 16 | transition matrices, one per cycle). 17 | } 18 | \description{ 19 | Evaluate a transition matrix using evaluated parameters. 20 | } 21 | \details{ 22 | Runs checks on the transition matrix during evaluation. 23 | 24 | This functions has been heavily optimized, and thus can 25 | be difficult to read. Good luck... 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /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/resample_surv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/density.R 3 | \name{resample_surv} 4 | \alias{resample_surv} 5 | \alias{resample_surv_boot} 6 | \alias{resample_surv_dist} 7 | \alias{r_resample_surv_dist} 8 | \alias{r_boot_survfit} 9 | \title{Resample survival distribution} 10 | \usage{ 11 | resample_surv(n) 12 | 13 | resample_surv_boot(x) 14 | 15 | resample_surv_dist(x, n) 16 | 17 | r_resample_surv_dist(distribution, type, args) 18 | 19 | r_boot_survfit(x) 20 | } 21 | \arguments{ 22 | \item{n}{the number of observations to generate if dist is specified or x is a \code{surv_dist} 23 | object 24 | 25 | The lower n is, the higher is the variability} 26 | 27 | \item{x}{a \code{surv_object}} 28 | } 29 | \description{ 30 | Resample survival distribution 31 | } 32 | \keyword{internal} 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{quosures} object.} 11 | } 12 | \value{ 13 | A modified \code{quosures} 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 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /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 | https://savi.shef.ac.uk/SAVI/ 29 | } 30 | -------------------------------------------------------------------------------- /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/add_hazards.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{add_hazards} 4 | \alias{add_hazards} 5 | \alias{add_hazards_} 6 | \title{Add Hazards} 7 | \usage{ 8 | add_hazards(...) 9 | 10 | add_hazards_(dots) 11 | } 12 | \arguments{ 13 | \item{...}{Survival distributions to be used in the 14 | projection.} 15 | 16 | \item{dots}{Used to work around non-standard evaluation.} 17 | } 18 | \value{ 19 | A \code{surv_add_haz} object. 20 | } 21 | \description{ 22 | Get a survival distribution reflecting the independent 23 | hazards from two or more survival distributions. 24 | } 25 | \examples{ 26 | 27 | dist1 <- define_surv_dist(distribution = "exp", rate = .125) 28 | dist2 <- define_surv_dist(distribution = "weibull", shape = 1.2, scale = 50) 29 | combined_dist <- add_hazards(dist1, dist2) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/get_counts_diff.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_counts_diff} 4 | \alias{get_counts_diff} 5 | \title{Get count matrix and difference between two cycles} 6 | \usage{ 7 | get_counts_diff(x, init, inflow) 8 | } 9 | \arguments{ 10 | \item{x}{transition matrix} 11 | 12 | \item{init}{numeric vector, same length as number of 13 | model states. Number of individuals in each model state 14 | at the beginning.} 15 | 16 | \item{inflow}{numeric vector, similar to \code{init}. 17 | Number of new individuals in each state per cycle.} 18 | } 19 | \value{ 20 | A length 2 list of matrix : the count matrix for each cycle and the diff matrix 21 | showing the difference of counts between two cycles. 22 | } 23 | \description{ 24 | Get count matrix and difference between two cycles 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /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 weights, 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/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 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | dplyr::filter( 26 | get_counts(x), 27 | state_names == "A" & model_time == 10 28 | )$count 29 | } 30 | f(res_mod) 31 | 32 | #'\dontrun{ 33 | #'calibrate_model( 34 | #' res_mod, 35 | #' parameter_names = "p", 36 | #' fn_values = f, 37 | #' target_values = 130, 38 | #' initial_values = data.frame(p = c(0.5, 0.9)), 39 | #' lower = 0, upper = 1 40 | #') 41 | #'} 42 | -------------------------------------------------------------------------------- /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, model_time = model_time, 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, model_time = model_time, 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, model_time = model_time, 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, model_time = model_time, markov_cycle_length = 1, pred_type = ""prob"")" 8 | utility.dr,0.000671233 9 | cost.dr,0.000671233 10 | -------------------------------------------------------------------------------- /man/define_surv_dist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_define.R 3 | \name{define_surv_dist} 4 | \alias{define_surv_dist} 5 | \title{Define a Survival Distribution} 6 | \usage{ 7 | define_surv_dist( 8 | distribution = c("exp", "weibull", "weibullPH", "lnorm", "llogis", "gamma", "gompertz", 9 | "gengamma", "gengamma.orig", "genf", "genf.orig"), 10 | ... 11 | ) 12 | } 13 | \arguments{ 14 | \item{distribution}{A parametric survival distribution.} 15 | 16 | \item{...}{Additional distribution parameters (see 17 | respective distribution help pages).} 18 | } 19 | \value{ 20 | A \code{surv_dist} object. 21 | } 22 | \description{ 23 | Define a parametric survival distribution. 24 | } 25 | \examples{ 26 | 27 | define_surv_dist(distribution = "exp", rate = .5) 28 | define_surv_dist(distribution = "gompertz", rate = .5, shape = 1) 29 | 30 | } 31 | -------------------------------------------------------------------------------- /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(x, cycles = 1, strategy_name = NA) 8 | } 9 | \arguments{ 10 | \item{x}{an \code{uneval_parameters} object.} 11 | 12 | \item{cycles}{integer. Number of cycles to simulate.} 13 | } 14 | \value{ 15 | An object of class \code{eval_parameters} 16 | (actually a data.frame with one column per parameter 17 | and one row per cycle). 18 | } 19 | \description{ 20 | Evaluate parameters specified through 21 | \code{define_parameters}, for a given number of cycles. 22 | } 23 | \examples{ 24 | param <- define_parameters( 25 | age_start = 60, 26 | age = age_start + model_time 27 | ) 28 | 29 | heemod:::eval_parameters(param, cycles = 15) 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/mix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{mix} 4 | \alias{mix} 5 | \alias{mix_} 6 | \title{Mix Two or More Survival Distributions} 7 | \usage{ 8 | mix(..., weights = 1) 9 | 10 | mix_(dots, weights = 1) 11 | } 12 | \arguments{ 13 | \item{...}{Survival distributions to be used in the 14 | projection.} 15 | 16 | \item{weights}{A vector of weights used in pooling.} 17 | 18 | \item{dots}{Used to work around non-standard evaluation.} 19 | } 20 | \value{ 21 | A \code{surv_pooled} object. 22 | } 23 | \description{ 24 | Mix a set of survival distributions using the specified 25 | weights. 26 | } 27 | \examples{ 28 | 29 | dist1 <- define_surv_dist(distribution = "exp", rate = .5) 30 | dist2 <- define_surv_dist(distribution = "gompertz", rate = .5, shape = 1) 31 | pooled_dist <- mix(dist1, dist2, weights = c(0.25, 0.75)) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/define_surv_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_define.R 3 | \name{define_surv_table} 4 | \alias{define_surv_table} 5 | \alias{define_surv_table.data.frame} 6 | \alias{define_surv_table.character} 7 | \title{Define a survival distribution based on explicit survival probabilities} 8 | \usage{ 9 | define_surv_table(x) 10 | 11 | \method{define_surv_table}{data.frame}(x) 12 | 13 | \method{define_surv_table}{character}(x) 14 | } 15 | \arguments{ 16 | \item{x}{a data frame with columns \code{time} and \code{survival}} 17 | } 18 | \value{ 19 | a \code{surv_table} object, which can be used with \code{\link[=compute_surv]{compute_surv()}}. 20 | } 21 | \description{ 22 | Define a survival distribution based on explicit survival probabilities 23 | } 24 | \examples{ 25 | x <- data.frame(time = c(0, 1, 5, 10), survival = c(1, 0.9, 0.7, 0.5)) 26 | define_surv_table(x) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /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{heemod} Model From Tabular Files Info} 6 | \usage{ 7 | create_model_from_tabular(state_info, tm_info, df_env = globalenv()) 8 | } 9 | \arguments{ 10 | \item{state_info}{A state tabular file (file path or 11 | parsed file).} 12 | 13 | \item{tm_info}{A transition matrix tabular file (file 14 | path or parsed file).} 15 | 16 | \item{df_env}{An environment containing external data.} 17 | } 18 | \value{ 19 | A \code{heemod} model as returned by 20 | \code{\link[=define_strategy]{define_strategy()}}. 21 | } 22 | \description{ 23 | Calls \code{\link[=create_states_from_tabular]{create_states_from_tabular()}} and 24 | \code{\link[=create_matrix_from_tabular]{create_matrix_from_tabular()}}. 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/apply_shift.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{apply_shift} 4 | \alias{apply_shift} 5 | \title{Apply a time shift to a survival distribution} 6 | \usage{ 7 | apply_shift(dist, shift) 8 | } 9 | \arguments{ 10 | \item{dist}{A survival distribution.} 11 | 12 | \item{shift}{A time shift to be applied.} 13 | } 14 | \value{ 15 | A \code{surv_shift} object. 16 | } 17 | \description{ 18 | Apply a time shift to a survival distribution 19 | } 20 | \details{ 21 | A positive shift moves the fit backwards in time. That is, 22 | a shift of 4 will cause time 5 to be evaluated as time 1, and so on. 23 | If \code{shift == 0}, \code{dist} is returned unchanged. 24 | } 25 | \examples{ 26 | 27 | dist1 <- define_surv_dist(distribution = "gamma", rate = 0.25, shape = 3) 28 | shift_dist <- apply_shift(dist1, 4) 29 | compute_surv(dist1, 1:10) 30 | compute_surv(shift_dist, 1:10) 31 | } 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 + model_time,,,, 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 * ((model_time-1)^gamma - model_time^gamma)),,,, 17 | pHRFailNew,1 - exp(lambdaNew * ((model_time-1)^gamma - model_time^gamma)),,,, 18 | -------------------------------------------------------------------------------- /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 + model_time,,,, 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 * ((model_time-1)^gamma - model_time^gamma)),,,, 17 | pHRFailNew,1 - exp(lambdaNew * ((model_time-1)^gamma - model_time^gamma)),,,, 18 | -------------------------------------------------------------------------------- /man/compute_surv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_eval.R 3 | \name{compute_surv} 4 | \alias{compute_surv} 5 | \title{Evaluate Survival Distributions} 6 | \usage{ 7 | compute_surv(x, time, cycle_length = 1, type = c("prob", "survival"), ...) 8 | } 9 | \arguments{ 10 | \item{x}{A survival object} 11 | 12 | \item{time}{The \code{model_time} or \code{state_time} for which 13 | to predict.} 14 | 15 | \item{cycle_length}{The value of a Markov cycle in 16 | absolute time units.} 17 | 18 | \item{type}{Either \code{prob}, for transition probabilities, 19 | or \code{surv}, for survival.} 20 | 21 | \item{...}{arguments passed to methods.} 22 | } 23 | \value{ 24 | Returns either the survival probabilities or 25 | conditional probabilities of event for each cycle. 26 | } 27 | \description{ 28 | Generate either survival probabilities or conditional 29 | probabilities of event for each model cycle. 30 | } 31 | -------------------------------------------------------------------------------- /man/join.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{join} 4 | \alias{join} 5 | \alias{join_} 6 | \title{Project Beyond a Survival Distribution with Another} 7 | \usage{ 8 | join(..., at) 9 | 10 | join_(dots, at) 11 | } 12 | \arguments{ 13 | \item{...}{Survival distributions to be used in the 14 | projection.} 15 | 16 | \item{at}{A vector of times corresponding to the cut 17 | point(s) to be used.} 18 | 19 | \item{dots}{Used to work around non-standard evaluation.} 20 | } 21 | \value{ 22 | A \code{surv_projection} object. 23 | } 24 | \description{ 25 | Project survival from a survival distribution using one 26 | or more survival distributions using the specified cut points. 27 | } 28 | \examples{ 29 | 30 | dist1 <- define_surv_dist(distribution = "exp", rate = .5) 31 | dist2 <- define_surv_dist(distribution = "gompertz", rate = .5, shape = 1) 32 | join_dist <- join(dist1, dist2, at=20) 33 | } 34 | -------------------------------------------------------------------------------- /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,"binomial(0.12, 500)", 9 | age_init,60,,,, 10 | age,age_init + model_time,,,, 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 * ((model_time-1)^gamma - model_time^gamma)),,,, 17 | pHRFailNew,1 - exp(lambdaNew * ((model_time-1)^gamma - model_time^gamma)),,,, 18 | -------------------------------------------------------------------------------- /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,"binomial(0.12, 500)", 9 | age_init,60,,,, 10 | age,age_init + model_time,,,, 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 * ((model_time-1)^gamma - model_time^gamma)),,,, 17 | pHRFailNew,1 - exp(lambdaNew * ((model_time-1)^gamma - model_time^gamma)),,,, 18 | -------------------------------------------------------------------------------- /inst/examples/example_plot.surv_object.R: -------------------------------------------------------------------------------- 1 | ## Evaluation of the variability of the survival distribution 2 | \donttest{ 3 | surv1 <- define_surv_dist("exp", rate = 0.1) 4 | psa <- define_psa(surv1 ~ resample_surv(n = 100)) 5 | plot(surv1, psa=psa) 6 | 7 | ## plot surv_projection object 8 | surv2 <- define_surv_dist("exp", rate = 0.5) 9 | plot(join(surv1, surv2, at = 2), psa = psa, Nrep = 50) 10 | 11 | ## surv_fit object 12 | library(survival) 13 | km <- define_surv_fit(survfit(formula = Surv(time, status) ~ 1, data = aml)) 14 | fs <- flexsurv::flexsurvreg(formula = Surv(time, status) ~ 1, 15 | data = aml, 16 | dist = "weibull") |> 17 | define_surv_fit() 18 | 19 | psa2 <- define_psa(km ~ resample_surv(), 20 | fs ~ resample_surv(), 21 | surv1 ~ resample_surv(100)) 22 | plot(km, psa = psa2) 23 | 24 | plot(join(km, surv1, at = 6), psa = psa2) 25 | plot(join(fs, surv1, at = 6), psa = psa2) 26 | } 27 | -------------------------------------------------------------------------------- /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 | coefficients 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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(param_defs, df_env = globalenv()) 8 | } 9 | \arguments{ 10 | \item{param_defs}{A parameter definition file.} 11 | 12 | \item{df_env}{An environment containing external data.} 13 | } 14 | \value{ 15 | The parameter definition. 16 | } 17 | \description{ 18 | If specified in the tabular file, DSA and PSA can also be 19 | created. 20 | } 21 | \details{ 22 | The tabular parameter definition file can have the 23 | following columns: \code{parameter} (the parameter name, 24 | required), \code{value} (required), \code{low} and 25 | \code{high} (if both are present, a deterministic 26 | sensitivity analysis will be performed), and \code{psa} 27 | (a definition of a distribution to use in a probabilistic 28 | sensitivity analysis. Other columns will be ignored. 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /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/heemod_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{heemod_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 = TRUE, scale = TRUE) 13 | 14 | \method{scale}{psa}(x, center = TRUE, scale = TRUE) 15 | 16 | \method{scale}{run_model}(x, center = TRUE, 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 | -------------------------------------------------------------------------------- /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 + model_time 8 | ) 9 | 10 | # other uses of model_time are possible 11 | 12 | define_parameters( 13 | top_time = ifelse(model_time < 10, 1, 0) 14 | ) 15 | 16 | # more elaborate: risk function 17 | 18 | define_parameters( 19 | rate = 1 - exp(- model_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 model_time 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(model_time), 2) 34 | ) 35 | 36 | param <- define_parameters( 37 | age_start = 60, 38 | age = age_start + model_time 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 | -------------------------------------------------------------------------------- /man/part_survs_from_surv_inputs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/part_surv.R 3 | \name{part_survs_from_surv_inputs} 4 | \alias{part_survs_from_surv_inputs} 5 | \title{Convert saved fits to partitioned survival objects} 6 | \usage{ 7 | part_survs_from_surv_inputs(surv_inputs, state_names) 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 | \value{ 16 | a tibble of partitioned survival objects, similar to the 17 | original tibble of survival fits, with all the columns 18 | except type and fit, and a new column part_surv. 19 | } 20 | \description{ 21 | Convert saved fits to partitioned survival objects 22 | } 23 | \details{ 24 | surv_inputs is a tibble with columns 25 | type (PFS or OS, not case sensitive), treatment, 26 | set_name (for data subsets), 27 | dist (for survival distribution assumptions), 28 | fit (for the fitted survival object) and set_def 29 | (how the subset of data was defined, just to keep it around) 30 | } 31 | -------------------------------------------------------------------------------- /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 | 53 | 54 | #'\dontrun{ 55 | #'x <- run_dsa(res2, ds) 56 | #'plot(x, value = "cost") 57 | #'} 58 | #' 59 | #' 60 | # can be specified as a function of other parameters 61 | 62 | 63 | ds2 <- define_dsa( 64 | p2, p1 - .1, p1 + .1 65 | ) 66 | 67 | #'\dontrun{ 68 | #'run_dsa(res2, ds2) 69 | #'} -------------------------------------------------------------------------------- /docs/articles/h_tabular_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/a_introduction_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/c_homogeneous_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/f_sensitivity_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/i_reproduction_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/j_survival_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/k_calibration_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /man/define_surv_spline.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_define.R 3 | \name{define_surv_spline} 4 | \alias{define_surv_spline} 5 | \title{Define a Restricted Cubic Spline Survival Distribution} 6 | \usage{ 7 | define_surv_spline(scale = c("hazard", "odds", "normal"), ...) 8 | } 9 | \arguments{ 10 | \item{scale}{"hazard", "odds", or "normal", as described 11 | in flexsurvspline. With the default of no knots in 12 | addition to the boundaries, these models reduce to the 13 | Weibull, log-logistic and log-normal respectively. The 14 | scale must be common to all times.} 15 | 16 | \item{...}{Additional distribution parameters (see 17 | respective distribution help pages).} 18 | } 19 | \value{ 20 | A \code{surv_dist} object. 21 | } 22 | \description{ 23 | Define a restricted cubic spline parametric survival 24 | distribution. 25 | } 26 | \examples{ 27 | 28 | define_surv_spline( 29 | scale = "hazard", 30 | gamma = c(-18.3122, 2.7511, 0.2292), 31 | knots=c(4.276666, 6.470800, 7.806289) 32 | ) 33 | define_surv_spline( 34 | scale = "odds", 35 | gamma = c(-18.5809, 2.7973, 0.2035), 36 | knots=c(4.276666, 6.470800, 7.806289) 37 | ) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /docs/articles/b_time_dependency_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/d_non_homogeneous_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/e_probabilistic_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/g_heterogeneity_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.part_surv} 9 | \alias{interpolate.uneval_state_list} 10 | \title{Interpolate Quosures} 11 | \usage{ 12 | interpolate(x, ...) 13 | 14 | \method{interpolate}{default}(x, more = NULL, ...) 15 | 16 | \method{interpolate}{uneval_matrix}(x, ...) 17 | 18 | \method{interpolate}{state}(x, ...) 19 | 20 | \method{interpolate}{part_surv}(x, ...) 21 | 22 | \method{interpolate}{uneval_state_list}(x, ...) 23 | } 24 | \arguments{ 25 | \item{x}{A parameter, transition matrix or state list 26 | object.} 27 | 28 | \item{...}{Addition parameters passed to methods.} 29 | 30 | \item{more}{A list of expressions.} 31 | } 32 | \value{ 33 | An interpolated quosures object. 34 | } 35 | \description{ 36 | Sequentially interpolates quosures, optionally using 37 | external references. 38 | } 39 | \details{ 40 | The interpolation is sequential: the second dot is 41 | interpolated using the first, the third using the 42 | interpolated first two, and so on. 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /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} 6 | \title{Use WHO Mortality Rate} 7 | \usage{ 8 | get_who_mr(age, sex = NULL, region = NULL, year = "latest") 9 | } 10 | \arguments{ 11 | \item{age}{age as a continuous variable.} 12 | 13 | \item{sex}{sex as \code{"FMLE"}-\code{"MLE"}, \code{0}-\code{1} (male = 0, 14 | female = 1) or \code{1}-\code{2} (male = 1, female = 2).} 15 | 16 | \item{region}{Region code.} 17 | 18 | \item{year}{Use data from that year. Defaults to 19 | \code{"latest"}.} 20 | } 21 | \value{ 22 | This function should be used within 23 | \code{\link[=define_transition]{define_transition()}} or \code{\link[=define_parameters]{define_parameters()}}. 24 | } 25 | \description{ 26 | Returns age and sex-specific mortality probabilities for 27 | a given region 28 | } 29 | \details{ 30 | Only locally cached data are available. 31 | For memory space reasons 32 | local data is only available for WHO high-income 33 | countries (pooled), and only for the latest year. 34 | } 35 | \examples{ 36 | 37 | define_transition( 38 | C, get_who_mr(age = 50 + model_time, sex = "FMLE", region = "EUR"), 39 | 0, 1 40 | ) 41 | 42 | } 43 | -------------------------------------------------------------------------------- /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 + model_time, 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 | -------------------------------------------------------------------------------- /man/heemod-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/heemod.R 3 | \docType{package} 4 | \name{heemod-package} 5 | \alias{heemod} 6 | \alias{heemod-package} 7 | \title{Markov Models for Health Economic Evaluations} 8 | \description{ 9 | An implementation of the modelling and 10 | reporting features described in reference 11 | textbooks and guidelines: deterministic and 12 | probabilistic sensitivity analysis, 13 | heterogeneity analysis, time dependency 14 | on state-time and model-time (semi-Markov 15 | and non-homogeneous Markov models), etc. 16 | } 17 | \seealso{ 18 | Useful links: 19 | \itemize{ 20 | \item \url{https://aphp.github.io/heemod/} 21 | \item Report bugs at \url{https://github.com/aphp/heemod/issues} 22 | } 23 | 24 | } 25 | \author{ 26 | \strong{Maintainer}: Kevin Zarca \email{kevin.zarca@gmail.com} 27 | 28 | Authors: 29 | \itemize{ 30 | \item Antoine Filipovic-Pierucci 31 | } 32 | 33 | Other contributors: 34 | \itemize{ 35 | \item Matthew Wiener [contributor] 36 | \item Zdenek Kabat [contributor] 37 | \item Vojtech Filipec [contributor] 38 | \item Jordan Amdahl [contributor] 39 | \item Yonatan Carranza Alarcon [contributor] 40 | \item Vince Daniels [contributor] 41 | } 42 | 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /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 | ) 13 | } 14 | \arguments{ 15 | \item{inputs}{Result from 16 | \code{\link[=gather_model_info]{gather_model_info()}}.} 17 | 18 | \item{run_dsa}{Run DSA?} 19 | 20 | \item{run_psa}{Run PSA?} 21 | 22 | \item{run_demo}{Run demographic analysis?} 23 | } 24 | \value{ 25 | a list \itemize{ \item \code{models} (always) 26 | unevaluated model. \item \code{model_runs} (always) 27 | evaluated models \item \code{dsa} (deterministic 28 | sensitivity analysis) - if appropriate parameters 29 | provided \item \code{psa} (probabilistic sensitivity 30 | analysis) - if appropriate parameters provided \item 31 | \code{demographics} results across different 32 | demographic groups - if appropriate parameters 33 | provided} 34 | } 35 | \description{ 36 | Execute a full set of analyses, possibly including 37 | discrete sensitivity analysis, probabilistic sensitivity 38 | analysis, and analyses across demographics. 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /R/correct_counts.R: -------------------------------------------------------------------------------- 1 | correct_counts <- function(x, method = c("life-table", 2 | "beginning", 3 | "end")) { 4 | counts <- x$counts 5 | diff <- x$diff 6 | if (! is.function(method)) { 7 | method <- match.arg(method) 8 | 9 | n0 <- counts[- nrow(counts), ] 10 | 11 | n1 <- counts[-1, ] 12 | 13 | out <- list() 14 | 15 | switch( 16 | method, 17 | "end" = { 18 | out$counts <- n1 19 | if(!is.null(diff)) out$diff <- diff 20 | }, 21 | "beginning" = { 22 | out$counts <- n0 23 | if(!is.null(diff)) out$diff <- diff 24 | }, 25 | "life-table" = { 26 | out$counts <- (n0 + n1) / 2 27 | if(!is.null(diff)){ 28 | out$diff <- lapply(seq_along(diff), function(i){ 29 | half <- diff[[i]] / 2 30 | if (i > 1) half <- half + diff[[i-1]]/2 31 | return(half) 32 | }) 33 | } 34 | }) 35 | } else { 36 | out <- method(counts) 37 | } 38 | 39 | if (nrow(out$counts) != nrow(counts) - 1) { 40 | stop("State membership correction applied to an n-row table should return a table with n-1 rows.") 41 | } 42 | 43 | return(structure(out, method=method)) 44 | } 45 | -------------------------------------------------------------------------------- /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 + model_time 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 | 62 | #'\dontrun{ 63 | #'ndt2 <- update(res, newdata = new_tab2) 64 | #' 65 | #'summary(ndt2) 66 | #'} 67 | -------------------------------------------------------------------------------- /tests/testthat/test_parallel.R: -------------------------------------------------------------------------------- 1 | test_that( 2 | "Same results using 1 core or 2.", { 3 | 4 | library(parallel) 5 | result_1core <- run_model_tabular( 6 | location = system.file("tabular/thr", package = "heemod"), 7 | save = FALSE, overwrite = FALSE, run_psa = FALSE 8 | ) 9 | 10 | result_2core <- run_model_tabular( 11 | location = system.file("tabular/thr", package = "heemod"), 12 | reference = "REFERENCE_2core.csv", 13 | save = FALSE, overwrite = FALSE, run_psa = FALSE 14 | ) 15 | ## the objects contain environments, so we can't use identical; 16 | ## instead, we'll check parts that use multi-core processing 17 | ## 18 | ## parameters from the discrete sensitivity analysis 19 | expect_identical( 20 | sapply(result_1core$dsa$dsa$.par_value, eval_tidy), 21 | sapply(result_2core$dsa$dsa$.par_value, eval_tidy) 22 | ) 23 | ## counts from all models from the discrete sensitivity analysis 24 | expect_identical( 25 | get_counts(get_model(result_1core$dsa)), 26 | get_counts(get_model(result_2core$dsa))) 27 | ## demographic analysis 28 | expect_equal( 29 | result_1core$demographics$updated_model[-3], 30 | result_2core$demographics$updated_model[-3], 31 | ignore_attr = TRUE) 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /man/expand_state.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand.R 3 | \name{expand_state} 4 | \alias{expand_state} 5 | \alias{expand_state.uneval_matrix} 6 | \alias{expand_state.uneval_state_list} 7 | \alias{expand_state.uneval_inflow} 8 | \alias{expand_state.uneval_init} 9 | \title{Expand Time-Dependent States into Tunnel States} 10 | \usage{ 11 | expand_state(x, ...) 12 | 13 | \method{expand_state}{uneval_matrix}(x, state_pos, state_name, cycles, n = 1, ...) 14 | 15 | \method{expand_state}{uneval_state_list}(x, state_name, cycles, ...) 16 | 17 | \method{expand_state}{uneval_inflow}(x, ...) 18 | 19 | \method{expand_state}{uneval_init}(x, state_name, cycles, ...) 20 | } 21 | \arguments{ 22 | \item{x}{A transition matrix or a state list.} 23 | 24 | \item{...}{Addition parameters passed to methods.} 25 | 26 | \item{state_pos}{Position of the state to expand.} 27 | 28 | \item{state_name}{Original name of the sate to expand.} 29 | 30 | \item{cycles}{Number of cycle of the model.} 31 | 32 | \item{n}{Position in the expansion process.} 33 | } 34 | \value{ 35 | The same object type as the input. 36 | } 37 | \description{ 38 | This function for transition matrices and state values 39 | expands states relying on \code{state_time} in a series 40 | of tunnels states. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /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. Should be a scalar if time is 6 | specified, a vector otherwise} 7 | \usage{ 8 | discount(x, r, first = FALSE, period = 1, linear = FALSE, time) 9 | } 10 | \arguments{ 11 | \item{x}{numeric. A quantity to discount.} 12 | 13 | \item{r}{discount rate.} 14 | 15 | \item{first}{logical. Should discounting start at the 16 | first value?} 17 | 18 | \item{period}{Number of cycle per unit of discount rate.} 19 | 20 | \item{linear}{logical. Should the discount rate vary linearly along the 21 | whole period?} 22 | 23 | \item{time}{The cycle number.} 24 | } 25 | \value{ 26 | A numeric vector of the same length as \code{x}. 27 | } 28 | \description{ 29 | Discount a Quantity Over Time. Should be a scalar if time is 30 | specified, a vector otherwise 31 | } 32 | \details{ 33 | If the unit of discount rate is the year and a cycle duration is 1 34 | month, period should be 12. 35 | } 36 | \examples{ 37 | 38 | discount(rep(10, 5), .02) 39 | discount(rep(10, 5), .02, first = FALSE) 40 | 41 | discount(1000, .05, time = 10) 42 | discount(1000, .05, period = 2, time = 1:10) 43 | discount(1000, .05, period = 2, time = 1:10, linear = TRUE) 44 | 45 | } 46 | \keyword{internal} 47 | -------------------------------------------------------------------------------- /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. The names must correspond to an existing state value.} 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 | This function is meant to be used inside \code{\link[=define_strategy]{define_strategy()}} and 24 | \code{\link[=define_state]{define_state()}}. 25 | } 26 | \details{ 27 | The behaviour is different following the function using \code{\link[=define_starting_values]{define_starting_values()}} 28 | as an argument. 29 | \itemize{ 30 | \item When used inside \code{\link[=define_strategy]{define_strategy()}}, the state values are modified for the 31 | first cycle in each state 32 | \item When used inside \code{\link[=define_state]{define_state()}}, the state values are modified for counts 33 | entering the state 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /man/compute_counts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/part_surv.R, R/strategy_eval.R 3 | \name{compute_counts.eval_part_surv} 4 | \alias{compute_counts.eval_part_surv} 5 | \alias{compute_counts} 6 | \alias{compute_counts.eval_matrix} 7 | \title{Compute Count of Individual in Each State per Cycle} 8 | \usage{ 9 | \method{compute_counts}{eval_part_surv}(x, init, inflow, ...) 10 | 11 | compute_counts(x, ...) 12 | 13 | \method{compute_counts}{eval_matrix}(x, init, inflow, ...) 14 | } 15 | \arguments{ 16 | \item{x}{An \code{eval_matrix} or 17 | \code{eval_part_surv} object.} 18 | 19 | \item{init}{numeric vector, same length as number of 20 | model states. Number of individuals in each model state 21 | at the beginning.} 22 | 23 | \item{inflow}{numeric vector, similar to \code{init}. 24 | Number of new individuals in each state per cycle.} 25 | } 26 | \value{ 27 | A \code{cycle_counts} object. 28 | } 29 | \description{ 30 | Given an initial number of individual and an evaluated 31 | transition matrix, returns the number of individual per 32 | state per cycle. 33 | } 34 | \details{ 35 | Use the \code{method} argument to specify if transitions 36 | are supposed to happen at the beginning or the end of 37 | each cycle. Alternatively linear interpolation between 38 | cycles can be performed. 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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_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 | -------------------------------------------------------------------------------- /man/construct_part_surv_tib.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/part_surv.R 3 | \name{construct_part_surv_tib} 4 | \alias{construct_part_surv_tib} 5 | \title{construct a survival object from tabular specification} 6 | \usage{ 7 | construct_part_surv_tib(surv_def, ref, state_names, env = new.env()) 8 | } 9 | \arguments{ 10 | \item{surv_def}{a data frame with the specification. See details.} 11 | 12 | \item{ref}{data frame with information about the fits.} 13 | 14 | \item{state_names}{names of the model states} 15 | 16 | \item{env}{an environment} 17 | } 18 | \value{ 19 | a list with one element for each strategy. Each element 20 | is in turn a \code{part_surv} object, a list with two elements, 21 | pfs and os. And those 22 | elements are survival objects of various kinds, with the 23 | commonality that they can be used in \code{\link[=compute_surv]{compute_surv()}}. 24 | } 25 | \description{ 26 | construct a survival object from tabular specification 27 | } 28 | \details{ 29 | This function is meant to be used only from within 30 | tabular_input.R. It won't work well otherwise, in that 31 | the environment is unlikely to have what you need. 32 | 33 | columns of surv_def: .strategy, .type, .subset, dist, until 34 | where dist can be either the name of a distribution 35 | along with parameters, or a reference to a fit 36 | for example: fit('exp') or exp(rate = 0.5) 37 | } 38 | -------------------------------------------------------------------------------- /man/set_covariates.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/survival_operations.R 3 | \name{set_covariates} 4 | \alias{set_covariates} 5 | \alias{set_covariates_} 6 | \title{Set Covariates of a Survival Distribution} 7 | \usage{ 8 | set_covariates(dist, ..., data = NULL) 9 | 10 | set_covariates_(dist, covariates, data = NULL) 11 | } 12 | \arguments{ 13 | \item{dist}{a survfit or flexsurvreg object} 14 | 15 | \item{...}{Covariate values representing the group for 16 | which survival probabilities will be generated when 17 | evaluated.} 18 | 19 | \item{data}{A an optional data frame representing 20 | multiple sets of covariate values for which survival 21 | probabilities will be generated. Can be used to 22 | generate aggregate survival for a heterogeneous set of 23 | subjects.} 24 | 25 | \item{covariates}{Used to work around non-standard 26 | evaluation.} 27 | } 28 | \value{ 29 | A \code{surv_model} object. 30 | } 31 | \description{ 32 | Set the covariate levels of a survival model to be 33 | represented in survival projections. 34 | } 35 | \examples{ 36 | 37 | fs1 <- flexsurv::flexsurvreg( 38 | survival::Surv(rectime, censrec)~group, 39 | data=flexsurv::bc, 40 | dist = "llogis" 41 | ) 42 | good_model <- set_covariates(fs1, group = "Good") 43 | cohort <- data.frame(group=c("Good", "Good", "Medium", "Poor")) 44 | mixed_model <- set_covariates(fs1, data = cohort) 45 | 46 | } 47 | -------------------------------------------------------------------------------- /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(..., starting_values = define_starting_values()) 10 | 11 | define_state_(x) 12 | 13 | \method{modify}{state}(.OBJECT, ...) 14 | } 15 | \arguments{ 16 | \item{...}{Name-value pairs of expressions defining state 17 | values.} 18 | 19 | \item{starting_values}{Optional starting values defined 20 | with \code{\link[=define_starting_values]{define_starting_values()}}.} 21 | 22 | \item{x}{Used to work around non-standard evaluation.} 23 | 24 | \item{.OBJECT}{An object of class \code{state}.} 25 | } 26 | \value{ 27 | An object of class \code{state} (actually a named 28 | list of quosures). 29 | } 30 | \description{ 31 | Define the values characterising a Markov Model state for 32 | 1 cycle. 33 | } 34 | \details{ 35 | As with \code{\link[=define_parameters]{define_parameters()}}, state values are 36 | defined sequentially. Later state definition can thus 37 | only refer to values defined earlier. 38 | 39 | For the \code{modify} function, existing values are 40 | modified, no new values can be added. Values order 41 | matters since only values defined earlier can be 42 | referenced in later expressions. 43 | } 44 | \examples{ 45 | st <- define_state( 46 | cost = 6453, 47 | utility = .876 48 | ) 49 | st 50 | } 51 | -------------------------------------------------------------------------------- /tests/testthat/test_check_init.R: -------------------------------------------------------------------------------- 1 | test_that( 2 | "check_init() works", { 3 | init1 <- define_init(a = 1, b = 0, c = 0) 4 | init2 <- c(a = 1, b = 0, c = 0) 5 | init2_bis <- c(a = 1, c = 0, b = 0) 6 | init3 <- c(1, 0, 0) 7 | init4 <- define_init(a = 1) 8 | 9 | ref <- letters[1:3] 10 | 11 | expect_identical( 12 | to_text_dots(check_init.quosures(init1, ref)), 13 | to_text_dots(check_init.default(init2, ref)) 14 | ) 15 | 16 | expect_identical( 17 | to_text_dots(check_init(init2, ref)), 18 | to_text_dots(check_init(init2_bis, ref)) 19 | ) 20 | 21 | expect_identical( 22 | to_text_dots(check_init(init1, ref)), 23 | to_text_dots(check_init(init3, ref)) 24 | ) 25 | 26 | expect_identical( 27 | to_text_dots(check_init(init1, ref)), 28 | to_text_dots(check_init(init4, ref)) 29 | ) 30 | 31 | expect_error( 32 | check_init(c(1, 0), ref) 33 | ) 34 | expect_error( 35 | check_init(c(a = 1, b = 0, x = 0), ref) 36 | ) 37 | expect_error( 38 | check_init(define_init(1, 0, 0), ref) 39 | ) 40 | expect_error( 41 | check_init(define_init(1, 0), ref) 42 | ) 43 | expect_error( 44 | check_init(define_init(a = 1, b = 0, x = 0), ref) 45 | ) 46 | expect_error( 47 | check_init(define_init(a = 1, x = 0), ref) 48 | ) 49 | expect_error( 50 | check_init(define_init(a = 1, a = 0), ref) 51 | ) 52 | } 53 | ) 54 | -------------------------------------------------------------------------------- /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{heemod} 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 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | release: 9 | types: [published] 10 | workflow_dispatch: 11 | 12 | name: pkgdown 13 | 14 | jobs: 15 | pkgdown: 16 | runs-on: ubuntu-latest 17 | # Only restrict concurrency for non-PR jobs 18 | concurrency: 19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 20 | env: 21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 22 | permissions: 23 | contents: write 24 | steps: 25 | - uses: actions/checkout@v3 26 | 27 | - uses: r-lib/actions/setup-pandoc@v2 28 | 29 | - uses: r-lib/actions/setup-r@v2 30 | with: 31 | use-public-rspm: true 32 | 33 | - uses: r-lib/actions/setup-r-dependencies@v2 34 | with: 35 | extra-packages: any::pkgdown, local::. 36 | needs: website 37 | 38 | - name: Build site 39 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 40 | shell: Rscript {0} 41 | 42 | - name: Deploy to GitHub pages 🚀 43 | if: github.event_name != 'pull_request' 44 | uses: JamesIves/github-pages-deploy-action@v4.4.1 45 | with: 46 | clean: false 47 | branch: gh-pages 48 | folder: docs 49 | -------------------------------------------------------------------------------- /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}, threshold 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/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{heemod} 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{heemod}. When the cluster is created it is 35 | automagically used by \code{heemod} functions. 36 | } 37 | \details{ 38 | The usual workflow 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 cluster needs to 47 | work with \code{\link[parallel:clusterApply]{parallel::parLapply()}}. 48 | } 49 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | - {os: windows-latest, r: 'devel', http-user-agent: 'devel'} 27 | 28 | env: 29 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 30 | R_KEEP_PKG_SOURCE: yes 31 | 32 | steps: 33 | - uses: actions/checkout@v3 34 | 35 | - uses: r-lib/actions/setup-pandoc@v2 36 | 37 | - uses: r-lib/actions/setup-r@v2 38 | with: 39 | r-version: ${{ matrix.config.r }} 40 | http-user-agent: ${{ matrix.config.http-user-agent }} 41 | use-public-rspm: true 42 | 43 | - uses: r-lib/actions/setup-r-dependencies@v2 44 | with: 45 | extra-packages: any::rcmdcheck 46 | needs: check 47 | 48 | - uses: r-lib/actions/check-r-package@v2 49 | with: 50 | upload-snapshots: true 51 | -------------------------------------------------------------------------------- /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 convenience functions make it easier to compute 45 | transition probabilities from incidence 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/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 | \title{Define Markov Model State List} 8 | \usage{ 9 | define_state_list(...) 10 | 11 | define_state_list_(.dots) 12 | 13 | \method{modify}{uneval_state_list}(.OBJECT, ...) 14 | } 15 | \arguments{ 16 | \item{...}{Name-value pairs of expressions defining model 17 | states.} 18 | 19 | \item{.dots}{List of states, only used by 20 | \code{define_state_list_} to avoid using \code{...}.} 21 | 22 | \item{.OBJECT}{An \code{uneval_states} object.} 23 | } 24 | \value{ 25 | An object of class \code{uneval_state_list} (a 26 | list of \code{state} objects). 27 | } 28 | \description{ 29 | Define the states of a Markov model by combining 30 | \code{state} objects. 31 | } 32 | \details{ 33 | State names have to correspond to those specified through 34 | \code{\link[=define_transition]{define_transition()}}. 35 | 36 | All states should have the same value names. 37 | 38 | The \code{modify} function can modify existing states or 39 | add new ones. 40 | } 41 | \examples{ 42 | \dontrun{ 43 | s1 <- define_state(cost = 1, util = 1) 44 | s2 <- define_state(cost = 3, util = .4) 45 | 46 | states_mod <- define_state_list( 47 | healthy = s1, 48 | sick = s2 49 | ) 50 | 51 | states_mod 52 | 53 | s1_bis <- define_state(cost = 0, util = 1) 54 | s3 <- define_state(cost = 10, util = .1) 55 | 56 | modify( 57 | states_mod, 58 | healthy = s1_bis, 59 | sicker = s3 60 | ) 61 | } 62 | 63 | } 64 | \keyword{internal} 65 | -------------------------------------------------------------------------------- /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(state_info, df_env = globalenv()) 8 | } 9 | \arguments{ 10 | \item{state_info}{Result for one model of 11 | \code{\link[=parse_multi_spec]{parse_multi_spec()}}.} 12 | 13 | \item{df_env}{An environment containing external data.} 14 | } 15 | \value{ 16 | A state list. 17 | } 18 | \description{ 19 | Transforms tabular input defining states into an 20 | \code{heemod} object. 21 | } 22 | \details{ 23 | Columns of state_info besides .model and state include 24 | costs and utilities we want to keep track of, with 25 | appropriate values (these may include parameters). For 26 | any cost or utility that should be discounted, an 27 | additional column with the name ".discount.\" or 28 | ".discount.\", for the appropriate cost or effect, 29 | can be included. If no discounting is desired for a 30 | particular cost or effect, the corresponding column can 31 | be omitted. 32 | 33 | A discount column can contain only a single value - a 34 | cost or benefit must be discounted by the same amount in 35 | each state. Discounts can be numbers or parameters (which 36 | will then need to be defined like any other). 37 | 38 | The input data frame is expected to contain state 39 | information for all the models you will use in an 40 | analysis. For more information see the vignette: 41 | \code{vignette("file-input", package = "heemod")}. 42 | } 43 | \keyword{internal} 44 | -------------------------------------------------------------------------------- /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(x, strategy = 1, newdata) 9 | } 10 | \arguments{ 11 | \item{x}{Result from \code{\link[=run_model]{run_model()}}.} 12 | 13 | \item{strategy}{Name or index of model to recompute.} 14 | 15 | \item{newdata}{a data.frame whose names match parameters 16 | names. \code{strategy} will be evaluated iteratively, 17 | taking successive values from each row.} 18 | } 19 | \value{ 20 | A data.frame containing the values of 21 | \code{newdata} and each Markov Model evaluation in 22 | \code{res}. 23 | } 24 | \description{ 25 | Given a data.frame with on set of new parameters values 26 | per row, iteratively evaluate the model over the set of 27 | new values. 28 | } 29 | \details{ 30 | New parameters with a missing value (\code{NA}) do not 31 | replace existing parameters. 32 | } 33 | \examples{ 34 | par1 <- define_parameters( 35 | a = 1, 36 | b = 1 / (model_time + a) 37 | ) 38 | 39 | mat1 <- define_transition( 40 | 1-b, b, 41 | 0, 1 42 | ) 43 | mod1 <- define_strategy( 44 | transition = mat1, 45 | define_state(var = a), 46 | define_state(var = a * model_time) 47 | ) 48 | 49 | res1 <- run_model( 50 | mod1, 51 | parameters = par1, 52 | cycles = 5, 53 | init = 1:0, 54 | method = "end" 55 | ) 56 | 57 | new_tab <- data.frame( 58 | a = 1:10 59 | ) 60 | 61 | heemod:::eval_strategy_newdata( 62 | res1, 63 | newdata = new_tab 64 | ) 65 | } 66 | \keyword{internal} 67 | -------------------------------------------------------------------------------- /R/states_print.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | print.state <- function(x, ...) { 3 | val <- x$.dots 4 | start <- x$starting_values 5 | nb_sv <- lapply(start, function(x){ 6 | get_expr(x) != 0 7 | }) %>% 8 | unlist() %>% 9 | sum() 10 | 11 | phrase_start <- ifelse(nb_sv > 0, sprintf(" and %i starting value%s", nb_sv, plur(nb_sv)), "") 12 | cat(sprintf( 13 | "A state with %i value%s%s.\n\n", 14 | length(val), plur(length(val)), 15 | phrase_start)) 16 | 17 | nv <- names(val) 18 | ex <- lapply(val, function(y) paste(as_label(y), collapse = "\n")) 19 | 20 | cat(paste(nv, ex, sep = " = "), sep = "\n") 21 | if (nb_sv > 0){ 22 | nv <- names(start) 23 | ex <- lapply(seq_along(start), function(i) { 24 | if (get_expr(start[[i]]) > 0) paste(names(start)[i], as_label(start[[i]]), collapse = "\n", sep = " = ") 25 | }) 26 | cat("Start", paste(ex[lengths(ex) != 0]), sep = "\n") 27 | } 28 | } 29 | 30 | #' @export 31 | print.uneval_state_list <- function(x, ...) { 32 | n_state <- get_state_number(x) 33 | n_values <- length(get_state_value_names(x)) 34 | 35 | cat(sprintf( 36 | "A list of %i state%s with %i value%s each.\n\n", 37 | n_state, 38 | plur(n_state), 39 | n_values, 40 | plur(n_values) 41 | )) 42 | cat("State names:\n\n") 43 | cat(get_state_names(x), sep = "\n") 44 | 45 | cat("\nState values:\n\n") 46 | cat(get_state_value_names(x), sep = "\n") 47 | } 48 | 49 | #' @export 50 | print.eval_state_list <- function(x, ...) { 51 | x <- x$.dots 52 | cat(sprintf( 53 | "%i evaluated state%s, %i Markov cycle%s.\n", 54 | length(x), 55 | plur(length(x)), 56 | nrow(x[[1]]), 57 | plur(nrow(x[[1]])) 58 | )) 59 | } 60 | -------------------------------------------------------------------------------- /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 demographic 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 | can be added, having value \code{TRUE} where an absolute 45 | file path is provided. \code{data} values must include 46 | \code{state}, \code{tm}, and \code{parameters}, and can 47 | also include \code{options}, \code{demographics} and 48 | \code{data}. The corresponding values in the \code{file} 49 | column give the names of the files (located in 50 | \code{base_dir}) that contain the corresponding 51 | information - or, in the case of \code{data}, the 52 | directory containing the tables to be loaded. 53 | } 54 | -------------------------------------------------------------------------------- /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(model, dsa) 8 | } 9 | \arguments{ 10 | \item{model}{An evaluated Markov model.} 11 | 12 | \item{dsa}{An object returned by 13 | \code{\link[=define_dsa]{define_dsa()}}.} 14 | } 15 | \value{ 16 | A \code{data.frame} with one row per model and 17 | parameter value. 18 | } 19 | \description{ 20 | Run Sensitivity Analysis 21 | } 22 | \examples{ 23 | param <- define_parameters( 24 | p1 = .5, 25 | p2 = .2, 26 | r = .05 27 | ) 28 | mod1 <- define_strategy( 29 | transition = define_transition( 30 | C, p1, 31 | p2, C 32 | ), 33 | define_state( 34 | cost = discount(543, r), 35 | ly = 1 36 | ), 37 | define_state( 38 | cost = discount(432, r), 39 | ly = .5 40 | ) 41 | ) 42 | 43 | mod2 <- define_strategy( 44 | transition = define_transition( 45 | C, p1, 46 | p2, C 47 | ), 48 | define_state( 49 | cost = 789, 50 | ly = 1 51 | ), 52 | define_state( 53 | cost = 456, 54 | ly = .8 55 | ) 56 | ) 57 | 58 | res2 <- run_model( 59 | mod1, mod2, 60 | parameters = param, 61 | init = c(100, 0), 62 | cycles = 10, 63 | cost = cost, 64 | effect = ly 65 | ) 66 | 67 | ds <- define_dsa( 68 | p1, .1, .9, 69 | p2, .1, .3, 70 | r, .05, .1 71 | ) 72 | print(ds) 73 | 74 | 75 | 76 | #'\dontrun{ 77 | #'x <- run_dsa(res2, ds) 78 | #'plot(x, value = "cost") 79 | #'} 80 | #' 81 | #' 82 | # can be specified as a function of other parameters 83 | 84 | 85 | ds2 <- define_dsa( 86 | p2, p1 - .1, p1 + .1 87 | ) 88 | 89 | #'\dontrun{ 90 | #'run_dsa(res2, ds2) 91 | #'} 92 | } 93 | -------------------------------------------------------------------------------- /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 quosures.} 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{heemod} 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 matrix 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 | --------------------------------------------------------------------------------