get_config {simaerep} | R Documentation |
Get Portfolio Configuration
Description
Get Portfolio configuration from a dataframe aggregated on
patient level with max_ae and max_visit. Will filter studies with only a few
sites and patients and will anonymize IDs. Portfolio configuration can be
used by sim_test_data_portfolio
to generate data for an
artificial portfolio.
Usage
get_config(
df_site,
min_pat_per_study = 100,
min_sites_per_study = 10,
anonymize = TRUE,
pad_width = 4
)
Arguments
df_site |
dataframe aggregated on patient level with max_ae and max_visit |
min_pat_per_study |
minimum number of patients per study, Default: 100 |
min_sites_per_study |
minimum number of sites per study, Default: 10 |
anonymize |
logical, Default: TRUE |
pad_width |
padding width for newly created IDs, Default: 4 |
Value
dataframe with the following columns:
- study_id
study identification
- ae_per_visit_mean
mean AE per visit per study
- site_number
site
- max_visit_sd
standard deviation of maximum patient visits per site
- max_visit_mean
mean of maximum patient visits per site
- n_pat
number of patients
See Also
sim_test_data_study
get_config
sim_test_data_portfolio
sim_ur_scenarios
get_portf_perf
Examples
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