Welcome to ClientVPS Mirrors

How to simulate continuous data

How to simulate continuous data

library(NCC)

datasim_cont()

The function datasim_cont() enables data simulation of a platform trial with continuous endpoint and an arbitrary number of treatment arms entering at different time points.

Assumptions

Notation

Paper Software
\(N\) n_total
\(K\) num_arms
\(d\) d
\(n\) n_arm
\(\eta_0\) mu0
\(\theta\) theta
\(\lambda\) lambda
\(\sigma\) sigma
\(N_p\) N_peak

Usage

Input

The user specifies the number of treatment arms in the trial, the sample size per treatment arm (assumed equal) and the timing of adding arms in terms of patients recruited to the trial so far.

Output

Per default (using full=FALSE), the function outputs a dataframe with simulated trial data needed for the analysis. If the parameter full is set to TRUE, the output is a list containing an extended version of the dataframe (also including lambdas and underlying responses) and all input parameters.

Examples

# Dataset with trial data only (default)

head(datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250), 
                  theta = rep(0.25, 3), lambda = rep(0.15, 4), 
                  sigma = 1, trend = "linear"))
  j    response treatment period
1 1 -0.02637641         0      1
2 2 -0.44194196         1      1
3 3  1.32774428         0      1
4 4 -0.62595318         1      1
5 5 -0.46338757         0      1
6 6  1.45766854         0      1
# Full dataset

head(datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250), 
                  theta = rep(0.25, 3), lambda = rep(0.15, 4), 
                  sigma = 1, trend = "linear", full = T)$Data)
  j   response treatment period        means lambda0 lambda1 lambda2 lambda3
1 1  0.9854557         1      1 0.2500000000    0.15    0.15    0.15    0.15
2 2  0.3121772         1      1 0.2503006012    0.15    0.15    0.15    0.15
3 3 -0.4321393         0      1 0.0006012024    0.15    0.15    0.15    0.15
4 4 -0.4704220         0      1 0.0009018036    0.15    0.15    0.15    0.15
5 5 -0.7243510         0      1 0.0012024048    0.15    0.15    0.15    0.15
6 6  0.4558754         1      1 0.2515030060    0.15    0.15    0.15    0.15

Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.

This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.