This class can be used to simulate the arrival times of patients in a simulated trial. The function NewAccrualProcess returns an object used to simulate arrival times for patients by calling The class assumes a Poisson process and allows the user to several options, such as ramp up the accrual rate which typically occurs in clinical trials. #' For this function you must supply nMaxQtyPatients and/or nMaxMonthsOfAccrual Accrual will continue until either the max qty of patient or max months of accrual is reached, which ever comes first
NewAccrualProcess(vQtyPatsPerMonth, nMaxQtyPatients, nMaxMonthsOfAccrual)If both nMaxQtyPatients and nMaxMonthsOfAccrual are supplied then the returned vector will be at most nMaxQtyPatients in length. However, when nMaxMonthsOfAccrual all values will be less than nMaxMonthsOfAccrual so the length of the returned vector could be less than nMaxQtyPatient.
SimulateArrivalTimes for simulating the arrival times once you have created the object..
vPatsPerMonth <- c(5, 10, 15, 20, 30, 40, 50) # The ramp up in expected Pat/month
nMaxQtyPats <- 100 # Maximum of 100 patients
ap <- NewAccrualProcess( vQtyPatsPerMonth = vPatsPerMonth, nMaxQtyPatients = nMaxQtyPats )
vAccTimes <- SimulateArrivalTimes( ap )