Learn R Programming

BIGL (version 1.5.3)

generateData: Generate data from parameters of marginal monotherapy model

Description

This function is used to generate data for bootstrapping of the null distribution for various estimates. Optional arguments such as specific choice of sampling vector or corrections for heteroskedasticity can be specified in the function arguments.

Usage

generateData(
  pars,
  sigma,
  data = NULL,
  transforms = NULL,
  null_model = c("loewe", "hsa", "bliss", "loewe2"),
  error = 1,
  sampling_errors = NULL,
  wild_bootstrap = FALSE,
  ...
)

Arguments

pars

Coefficients of the marginal model along with their appropriate naming scheme. These will typically be estimated using fitMarginals. Futhermore, pars can simply be a MarginalFit object and transforms object will be automatically extracted.

sigma

Standard deviation to use for randomly generated error terms. This argument is unused if error = 4 so that sampling error vector is provided.

data

Data frame with dose columns ("d1", "d2") to generate the effect for. Only "d1" and "d2" columns of the dose-response dataframe should be passed to this argument. "effect" column should not be passed and if it is, the column will be replaced by simulated data.

transforms

Transformation functions. If non-null, transforms is a list containing 5 elements, namely biological and power transformations along with their inverse functions and compositeArgs which is a list with argument values shared across the 4 functions. See vignette for more information.

null_model

Specified null model for the expected response surface. Currently, allowed options are "loewe" for generalized Loewe model, "hsa" for Highest Single Agent model, "bliss" for Bliss additivity, and "loewe2" for the alternative Loewe generalization.

error

Type of error for resampling. error = 1 (Default) adds normal errors to the simulated effects, error = 2 adds errors sampled from a mixture of two normal distributions, error = 3 generates errors from a rescaled chi-square distribution. error = 4 will use bootstrap. Choosing this option, the error terms will be resampled from the vector specified in sampling_errors.

sampling_errors

Sampling vector to resample errors from. Used only if error = 4.

wild_bootstrap

Whether special bootstrap to correct for heteroskedasticity should be used. If wild_bootstrap = TRUE, errors are generated from sampling_errors multiplied by a random variable following Rademacher distribution. Argument is used only if error = 4.

...

Further arguments

Value

Dose-response dataframe with generated data including "effect" as well as "d1" and "d2" columns.

Examples

Run this code
# NOT RUN {
  coefs <- c("h1" = 1, "h2" = 1.5, "b" = 0,
             "m1" = 1, "m2" = 2, "e1" = 0.5, "e2" = 0.1)

  ## Dose levels are set to be integers from 0 to 10
  generateData(coefs, sigma = 1)

  ## Dose levels are taken from existing dataset with d1 and d2 columns
  data <- subset(directAntivirals, experiment == 1)
  generateData(data = data[, c("d1", "d2")], pars = coefs, sigma = 1)
# }

Run the code above in your browser using DataLab