Skip to contents

Calculates visit_med75, n_pat_with_med75 and mean_ae_site_med75

Usage

site_aggr(df_visit, method = "med75_adj", min_pat_pool = 0.2, check = TRUE)

Arguments

df_visit

dataframe with columns: study_id, site_number, patnum, visit, n_ae

method

character, one of c("med75", "med75_adj") defining method for defining evaluation point visit_med75 (see details), Default: "med75_adj"

min_pat_pool,

double, minimum ratio of available patients available for sampling. Determines maximum visit_med75 value see Details. Default: 0.2

check,

logical, perform data check and attempt repair with check_df_visit(), computationally expensive on large data sets. Default: TRUE

Value

dataframe with the following columns:

study_id

study identification

site_number

site identification

n_pat

number of patients, site level

visit_med75

adjusted median(max(visit)) * 0.75 see Details

n_pat_with_med75

number of patients that meet visit_med75 criterion, site level

mean_ae_site_med75

mean AE at visit_med75, site level

Details

For determining the visit number at which we are going to evaluate AE reporting we take the maximum visit of each patient at the site and take the median. Then we multiply with 0.75 which will give us a cut-off point determining which patient will be evaluated. Of those patients we will evaluate we take the minimum of all maximum visits hence ensuring that we take the highest visit number possible without excluding more patients from the analysis. In order to ensure that the sampling pool for that visit is large enough we limit the visit number by the 80% quantile of maximum visits of all patients in the study.

Examples

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

df_visit$study_id <- "A"

df_site <- site_aggr(df_visit)

df_site %>%
  knitr::kable(digits = 2)
#> 
#> 
#> |study_id |site_number | n_pat| n_pat_with_med75| visit_med75| mean_ae_site_med75|
#> |:--------|:-----------|-----:|----------------:|-----------:|------------------:|
#> |A        |S0001       |    20|               18|          15|               2.39|
#> |A        |S0002       |    20|               19|          13|               2.68|
#> |A        |S0003       |    20|               19|          16|               7.74|
#> |A        |S0004       |    20|               16|          17|               8.69|
#> |A        |S0005       |    20|               16|          18|               8.19|