Skip to contents

Internal Function used by sim_sites()

Usage

get_pat_pool_config(df_visit, df_site, min_n_pat_with_med75 = 1)

Arguments

df_visit

dataframe

df_site

dataframe as created by site_aggr()

min_n_pat_with_med75

minimum number of patients with visit_med_75 for simulation, Default: 1

Value

dataframe

Details

For simulating a study we need to configure the study patient pool to match the configuration of the sites

Examples

df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 5,
                                      frac_site_with_ur = 0.4, ur_rate = 0.6)

df_visit1$study_id <- "A"

df_visit2 <- sim_test_data_study(n_pat = 1000, n_sites = 3,
                                      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 <- site_aggr(df_visit)

df_config <- get_pat_pool_config(df_visit, df_site)

df_config
#> # A tibble: 8 × 6
#>   study_id site_number visit_med75 n_pat_with_med75 n_pat_study pat_pool
#>   <chr>    <chr>             <dbl>            <dbl>       <dbl> <list>  
#> 1 A        S0001                15               19          71 <tibble>
#> 2 A        S0002                15               18          72 <tibble>
#> 3 A        S0003                16               17          66 <tibble>
#> 4 A        S0004                15               20          70 <tibble>
#> 5 A        S0005                16               16          67 <tibble>
#> 6 B        S0001                15              302         602 <tibble>
#> 7 B        S0002                15              301         603 <tibble>
#> 8 B        S0003                15              301         603 <tibble>