knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

This vignette aims to present how to use the training rando package.

Design of the clinical trial

During the design of the clinical trial, the prognostic factors are listed and the number of treatment arms is defined.

Definition of the prognotic factor(s)

Let's imagine a study with 3 prognostic factors. For instance:

library(trainingrando)
myprogfact <- CreatePrgFact(progfactLabel = "Age Group",progfactLevels=c("0-18 years", "19-35 years","36-60 years","> 60 years"))
myprogfact <- AddNewPrgFact(currentProgfact=myprogfact,progfactLabel = "Type of Tumor",progfactLevels=c("A", "B","C"))
myprogfact <- AddNewPrgFact(currentProgfact=myprogfact,progfactLabel = "Genotype.",progfactLevels=c("Genotype A", "Genotype B","Genotype C"))

Definition of the treatment arms

Let's say that the study has four treatment arms (1:1:1:1):

myArms <- ArmLevelProg(data.frame("Name" = c('Placebo', 'Treatement1','Treatement2','Treatement3')))

Enter patients in the study

Enter patients one by one

First patient in the study

Let's say that a first patient has been recruited and is entring in the study. A treatment is then randomly assigned to this first patient.

myRandoDataFrame <- AddFirstSubject(progfact=myprogfact,Arms=myArms)

Second patient in the study

Then a second patient enters in the study. This patient has also a his prognotics factors.

# Generate another patient
myRandoDataFrame <- AddNextSubject(RandoDataFrame=myRandoDataFrame, progfact=myprogfact)

Assign a treatment to the 2nd patient

The simplest approach is to use a randomization procedure whereby each patient has an equal probability 1/N of receiving any one of the N treatments.

myRandoDataFrame02 <- PurlyRandom(Arms=myArms,RandoDataFrame=myRandoDataFrame,usubjid="Pat-0002")

Enter patients in a batch

myRandoDataFrame <- GenStudyTrial(npat = 25, progfact = myprogfact, Arms=myArms)

Response

Create a response

The function AddAResponse create a response which is a constant:

$Y = \mu_0$

myResponse <- AddAResponse(RandoDataFrame=myRandoDataFrame,ResponseUnit='Weight (in kg)',RespValues=70)

Add a fixed effect

The function RespAddFixedEffect adds a fixed effect.

myResponse <- RespAddFixedEffect(Response=myResponse,RandoDataFrame=myRandoDataFrame,ColID=2, BetaVector=c(-1,0,0,1))

Add a residual variability

The function RespResidVar adds a residual variability which follows a normal distribution.

$Y2 = Y1 + \epsilon$

where

myResponse <- RespResidVar(Response=myResponse,SDReplicates=10)

Add residuals with a specified variance covariance matrix

myVarCovMatr <- UniformCorrelation(rho=0.5,sigma2=2,nTimePoints=6)
myepsilon <- espsilonVarCov(VarCovMatr=myVarCovMatr, nTimePoints=6, RandoDataFrame=myRandoDataFrame)


NicDubois/trainingrando documentation built on March 13, 2020, 5:33 a.m.