Skip to contents

Calculates visit_med75, n_pat_with_med75 and mean_ae_site_med75. Used by simaerep_classic()

Usage

site_aggr(
  df_visit,
  method = "med75_adj",
  min_pat_pool = 0.2,
  event_names = c("ae")
)

Arguments

df_visit

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

method

character, one of c("med75", "med75_adj", "max") 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

event_names

vector, contains the event names, default = "ae"

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. "max" will determine site max visit, flag patients that concluded max visit and count patients and patients that concluded max visit.

Examples

df_visit <- sim_test_data_study(
  n_pat = 100,
  n_sites = 5,
  ratio_out = 0.4,
  factor_event_rate = 0.6
  ) %>%
  # internal functions require internal column names
  dplyr::rename(
    n_ae = n_event,
    site_number = site_id,
    patnum = patient_id
  )

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|              18.33|
#> |A        |S0002       |    20|               16|          15|              16.75|
#> |A        |S0003       |    20|               18|          17|              10.61|
#> |A        |S0004       |    20|               19|          15|              11.42|
#> |A        |S0005       |    20|               17|          15|              10.65|