Learn R Programming

simaerep (version 1.0.0)

sim_test_data_portfolio: Simulate Portfolio Test Data

Description

Simulate visit level data from a portfolio configuration.

Usage

sim_test_data_portfolio(
  df_config,
  df_event_rates = NULL,
  progress = TRUE,
  parallel = TRUE
)

Value

dataframe with the following columns:

study_id

study identification

event_per_visit_mean

mean event per visit per study

site_id

site

max_visit_sd

standard deviation of maximum patient visits per site

max_visit_mean

mean of maximum patient visits per site

patient_id

number of patients

visit

visit number

n_event

cumulative sum of events

Arguments

df_config

dataframe as returned by get_portf_config

df_event_rates

dataframe with event rates. Default: NULL

progress

logical, Default: TRUE

parallel

logical activate parallel processing, see details, Default: FALSE

Details

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)

See Also

sim_test_data_study get_portf_config sim_test_data_portfolio

Examples

Run this code
# \donttest{
df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10,
                                 ratio_out = 0.4, factor_event_rate = 0.6,
                                 study_id = "A")

df_visit2 <- sim_test_data_study(n_pat = 100, n_sites = 10,
                                 ratio_out = 0.2, factor_event_rate = 0.1,
                                 study_id = "B")


df_visit <- dplyr::bind_rows(df_visit1, df_visit2)

df_config <- get_portf_config(df_visit)

df_config

df_portf <- sim_test_data_portfolio(df_config)

df_portf

# }

Run the code above in your browser using DataLab