Learn R Programming

DoseFinding (version 0.5-5)

genDFdata: Simulate dose-response data

Description

The function simulates normally distributed dose-response data, according to a prespecified dose-response model (or mean vector) and a given standard deviation.

Usage

genDFdata(model, argsMod, doses, n, sigma, mu = NULL, offset = NULL)

Arguments

model
Character string giving the name of a model function. The first argument of the model function should be the dose variable. See Dose-Response Models for details on the built
argsMod
A vector with the arguments for the model function, see Dose-Response Models for details on the built in dose-response models.
doses
Dose levels to be used.
n
Group sample sizes.
sigma
Standard deviation.
mu
If model is not specified mu is used to determine the mean vector of the observations.
offset
Offset vector. If not equal to NULL, offset is added to the mean of the simulated normal distribution

Value

  • A data frame with two columns called dose and resp, corresponding to the dose and simulated response values.

See Also

Dose-Response Models

Examples

Run this code
# use emax model
genDFdata("emax", c(e0 = 0.2, eMax = 1, ed50 = 0.05), c(0,0.05,0.2,0.6,1), 20, 1)
# use fixed mean vector
genDFdata(mu = 1:5, doses = 0:4, n = c(20, 20, 10, 5, 1), sigma = 0.2)
# use covariates via offset
X <- rbind(runif(100), c(rep(1,20), rep(0,80)))
beta <- c(1,0.3)
offset <- crossprod(X,beta)
genDFdata("emax", c(e0 = 0.2, eMax = 1, ed50 = 0.05),
          c(0,0.05,0.2,0.6,1), 20, 1, offset = offset)

Run the code above in your browser using DataLab