sim_test_data_portfolio | R Documentation |
Simulate visit level data from a portfolio configuration.
sim_test_data_portfolio(
df_config,
df_ae_rates = NULL,
parallel = FALSE,
progress = TRUE
)
df_config |
dataframe as returned by |
df_ae_rates |
dataframe with ae rates. Default: NULL |
parallel |
logical activate parallel processing, see details, Default: FALSE |
progress |
logical, Default: TRUE |
uses sim_test_data_study
.
We use the furrr
package to
implement parallel processing as these simulations can take a long time to
run. For this to work we need to specify the plan for how the code should
run, e.g. 'plan(multisession, workers = 3)
dataframe with the following columns:
study identification
mean AE per visit per study
site
standard deviation of maximum patient visits per site
mean of maximum patient visits per site
number of patients
visit number
cumulative sum of AEs
sim_test_data_study
get_config
sim_test_data_portfolio
sim_ur_scenarios
get_portf_perf
df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10,
frac_site_with_ur = 0.4, ur_rate = 0.6)
df_visit1$study_id <- "A"
df_visit2 <- sim_test_data_study(n_pat = 100, n_sites = 10,
frac_site_with_ur = 0.2, ur_rate = 0.1)
df_visit2$study_id <- "B"
df_visit <- dplyr::bind_rows(df_visit1, df_visit2)
df_site_max <- df_visit %>%
dplyr::group_by(study_id, site_number, patnum) %>%
dplyr::summarise(max_visit = max(visit),
max_ae = max(n_ae),
.groups = "drop")
df_config <- get_config(df_site_max)
df_config
df_portf <- sim_test_data_portfolio(df_config)
df_portf
df_scen <- sim_ur_scenarios(df_portf,
extra_ur_sites = 2,
ur_rate = c(0.5, 1))
df_scen
df_perf <- get_portf_perf(df_scen)
df_perf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.