Description Usage Arguments Value Examples
View source: R/data.simulator.r
Creates a raw data frame with specified number of trials, arms per trial, and features dependent on the type of response variable.
This raw data can then be passed through to the data.prep and net.tab()
functions for modeling purposes.
The number of patients per trial are generated uniformly between the minimum and maximum numbers specified.
Note that the resultant network is not guaranteed to be connected, and this criteria should be verified before model fitting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data.simulator(
nstudies,
response,
ntreatments,
seed,
min.patients,
max.patients,
event_p,
exp_rate,
cont_mean,
cont_var,
cont_error,
pt_rate,
count_mean,
min_time,
max_time
)
|
nstudies |
The number of studies in the simulated data set. Must be specified. |
response |
The type of response variable in each study; one of ("rate", "binary", "continuous", "rate2"), similar to |
ntreatments |
The total number of possible unique treatments in the network, which are randomly sampled and assigned to treatment arms. Must be specified. |
seed |
The seed value of the function for reproducibility (optional parameter). |
min.patients |
The minimum number of patients per trial. Must be specified. |
max.patients |
The maximum number of patients per trial. Must be specified. |
event_p |
The probability vector of an event occurring per individual, used for binary and rate2 data. Default is 0.5, and elements must be greater than 0 and less than or equal to 1. The vector length must be equal to the number of treatments, in which the ith element is the probability of outcome for treatment i. |
exp_rate |
The mean of the exponential distribution for follow-up times for rate2 data, parameterized as 1/lambda. Default is 0.01. Specified as a scalar; the follow-up times are assumed to be equal for both arms of the same trial. |
cont_mean |
The mean of the response variable for 'continuous' response data. Default is 0. Specified as a vector with length equal to the number of treatments, in which the ith element is the mean for treatment i. |
cont_var |
The standard error of the response variable for 'continuous' response data. Default is 1. Specified as a vector with length equal to the number of treatments, in which the ith element is the variance for treatment i. |
cont_error |
The maximum standard error of the response metric for each trial. Default is 1. Specified as a vector with length equal to the number of treatments, in which the ith element is the error for treatment i. |
pt_rate |
The mean of the exponential distribution for time-at-risk per person for 'rate' data, parametrized as 1/lambda. Default is 0.01. Specified as a scalar; the follow-up times per patient are generated to be the same for each arm within the same trial, and then get scaled by the number of patients in each arm. |
count_mean |
The mean of the Poisson distribution used to generate count data for 'rate' response data. Counts are generated by multiplying the rate parameter by the time-at-risk per person. Specified as a vector equal to the length of unique treatments. |
min_time |
The minimum of the uniform distribution which will be used to generate follow-up times for 'rate2' data. |
max_time |
The maximum of the uniform distribution which will be used to generate follow-up times for 'rate2' data. |
Data frame with studies, arms, sample sizes, and the parameters dependent on the selected response.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
data.simulator(nstudies=30, response="binary", ntreatments=5, seed=20,
min.patients=100, max.patients=500,
event_p=c(0.05, 0.10, 0.15, 0.07, 0.09))
data.simulator(nstudies=12, response="continuous",
ntreatments=6, seed=13, min.patients=30, max.patients=200)
data.simulator(nstudies=40, response="rate", ntreatments=5, seed=30,
min.patients=1000, max.patients=1200,
pt_rate = 1000*0.5, count_mean = c(45, 35, 47, 40, 42))
data.simulator(nstudies=20, response="rate2", ntreatments=6, seed=13,
min.patients=40, max.patients=500, min_time=3, max_time=5,
event_p = c(0.21, 0.5, 0.2, 0.3, 0.5, 0.55))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.