--- title: "Getting started with dynasimR" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting started with dynasimR} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} resource_files: - figures/logo.svg - figures/logo-dark.svg --- [![R-CMD-check](https://github.com/CTTIR/dynasimR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/CTTIR/dynasimR/actions/workflows/R-CMD-check.yaml) [![pkgdown](https://github.com/CTTIR/dynasimR/actions/workflows/pkgdown.yaml/badge.svg)](https://cttir.github.io/dynasimR/) [![Codecov test coverage](https://codecov.io/gh/CTTIR/dynasimR/branch/main/graph/badge.svg)](https://app.codecov.io/gh/CTTIR/dynasimR?branch=main) [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 4 ) ``` ```{r} library(dynasimR) ``` ## Load data ```{r} sim <- load_example_data() print(sim) ``` ## Time-to-event analysis ```{r} km <- km_estimate(sim, endpoint = "stage2", stratify_by = "scenario") plot_km(km, title = "Time-to-stage-2") ``` ## Policy effect ```{r} pol <- policy_effect(sim, policy_a_scenario = "A-S08", policy_b_scenario = "A-S07", n_bootstrap = 200) cat(pol$narrative) ``` ## Autonomy trade-off Only two AL points are present in the shipped example data, but the machinery is the same for a full AL sweep. ```{r} al <- al_efficiency( sim, al_scenarios = c("0" = "A-S00", "1" = "A-S01"), compliance_threshold = 0.80, n_bootstrap = 200 ) plot_al_tradeoff(al) ``` ## Manuscript-ready export ```{r, eval = FALSE} export_latex_table( data = pol$effect_sizes, filename = "policy_table.tex", caption = "Policy effect sizes.", label = "policy" ) ``` ## Launching the dashboard ```{r, eval = FALSE} launch_app() # example data launch_app(data_dir = "~/my-simulation/data/raw") ```