trial.simulation.cont {psBayesborrow}R Documentation

Simulating continuous data for current trial and external control

Description

A two-arm randomized clinical trial with a continuous outcome, which is augmented by external control data, is simulated.

Usage

trial.simulation.cont(
 n.CT, n.CC, n.ECp,
 out.mean.CT, out.sd.CT, out.mean.CC, out.sd.CC, driftdiff, out.sd.EC,
 cov.C, cov.cor.C, cov.EC, cov.cor.EC, cov.effect,
 seed=sample.int(.Machine$integer.max,1))

Arguments

n.CT

Number of patients in treatment group in the current trial.

n.CC

Number of patients in concurrent control group in the current trial.

n.ECp

Number of patients in external control pool.

out.mean.CT

True mean of outcome in treatment group in the current trial.

out.sd.CT

True sd of outcome in treatment group in the current trial.

out.mean.CC

True mean of outcome in concurrent control group in the current trial.

out.sd.CC

True sd of outcome in concurrent control group in the current trial.

driftdiff

Mean difference between concurrent and external control for which the bias should be plotted (mean in external control minus mean in concurrent control).

out.sd.EC

True sd of outcome in external control.

cov.C

List of covariate distributions for treatment and concurrent control group in the current trial. Continuous and binary covariate are applicable. The continuous covariate is assumed to follow a normal distribution; for example specified as list(dist="norm", mean=0, sd=1, lab="cov1"). The binary covariate is assumed to follow a binomial distribution; for example, specified as list(dist="binom", prob=0.4, lab="cov2"). lab is the column name of the covariate in the data frame generated.

cov.cor.C

Matrix of correlation coefficients for each pair of covariate for treatment and concurrent control group in the current trial, specified as Gaussian copula parameter.

cov.EC

List of covariate distributions for external control. The continuous covariate is assumed to follow a normal distribution; for example, specified as list(dist="norm", mean=0, sd=1, lab="cov1"). The binary covariate is assumed to follow a binomial distribution; for example, specified as list(dist="binom", prob=0.4, lab="cov2"). lab is the column name of the covariate in the data frame generated, which must be consistent with those used for cov.C.

cov.cor.EC

Matrix of correlation coefficients for each pair of covariate for external control, specified as Gaussian copula parameter.

cov.effect

Vector of covariate effects on the outcome, specified as mean change per one unit increase in continuous covariates or as mean change between categories for binary covariates.

seed

Setting a seed.

Details

The continuous outcome is assumed to follow a normal distribution. Given more than one covariates with their effects on the outcome, a normal linear regression model is constructed for data generation. The data frame generated include the continuous outcome data and covariates for n.CT and n.CC patients in treatment and concurrent control group in the current trial respectively, and n.ECp patients in external control pool. One record per patient. More than one covariates must be specified.

Value

The trial.simulation.cont returns a data frame containing the following variables:

study

Study indicator (0 for external control, and 1 for current trial)

treat

Treatment indicator (0 for concurrent and external control, and 1 for treatment)

y

Continuous outcome

column name specified

Covariate of interest

Examples

n.CT  <- 100
n.CC  <- 50
n.ECp <- 1000

out.mean.CT <- 0
out.sd.CT   <- 1
out.mean.CC <- 0
out.sd.CC   <- 1
driftdiff   <- 0
out.sd.EC   <- 1

cov.C <- list(list(dist="norm",mean=0,sd=1,lab="cov1"),
              list(dist="binom",prob=0.4,lab="cov2"))

cov.cor.C <- rbind(c(  1,0.1),
                   c(0.1,  1))

cov.EC <- list(list(dist="norm",mean=0,sd=1,lab="cov1"),
               list(dist="binom",prob=0.4,lab="cov2"))

cov.cor.EC <- rbind(c(  1,0.1),
                    c(0.1,  1))

cov.effect <- c(0.1,0.1)

trial.simulation.cont(
  n.CT=n.CT, n.CC=n.CC, n.ECp=n.ECp,
  out.mean.CT=out.mean.CT, out.sd.CT=out.sd.CT,
  out.mean.CC=out.mean.CC, out.sd.CC=out.sd.CC,
  driftdiff=driftdiff, out.sd.EC=out.sd.EC,
  cov.C=cov.C, cov.cor.C=cov.cor.C,
  cov.EC=cov.EC, cov.cor.EC=cov.cor.EC, cov.effect=cov.effect, seed=100)

[Package psBayesborrow version 1.1.0 Index]