Description Usage Arguments Details Examples
View source: R/DENSpatialRCT.R
Provide basic information on the RCT and the number of stochastic runs over which model runs should be averaged
1 2 | DEN.spatial.RCT(weekdates, fitdat, pastdat, unipix, pixdistmat, RCTinfo,
nruns, paramsList = NULL)
|
weekdates |
Two element vector of the start and end weeks of the simulation over which the mdoel will be evaluated over |
fitdat |
Data frame of the locations, numbers and timings (in weeks) of cases to fit the model to, see ?sgdat |
pastdat |
Data frame of the locations, numbers and timings (in weeks) of all cases in the dataset (is used to generate the starting immunity profile), see ?sgdat |
unipix |
Universal pixel lookup table, see ?make.unipix |
pixdistmat |
A patch distance matrix, see example |
RCTinfo |
A data frame including details on RCT start and end time, control and treatment patches and effective coverage reached in treatment patch |
nruns |
integer, number of stochastic runs of the model over which results should be averaged |
paramsList |
Optional parameter list. If not supplied returns to defaults, see tutorial for full parameter list, see ?model.run for full list and explanation of parameters |
runs "nruns" number of stochastic simulations and treats people in the trial treatment clusters at the specified time. Returns a named list of six matrices detailing the number of seroconversions and symptomatic cases in treatment and control patches with each columns of each matrix representing one realisation from the stochastic model. The final two elements in the list detail the total person-days of observation and total number of people treated with drugs in the trial.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | data(sgdat)
data(sgpop)
sgpop <- pop.process(sgpop, agg = 10)
unipix <- make.unipix(sgpop)
pixdistmat <- distm(cbind(unipix$x, unipix$y))
sgdat <- data.frame(sgdat, patchID = apply(cbind(sgdat[, 3:2]), 1, pix.id.find, unipix))
weekdates <- c(40, 92)
potential = (1:nrow(unipix))[unipix$pop > 1000]
potentialpops = unipix$pop[unipix$pop > 1000]
potential = cbind(potential, potentialpops)
randSam = sample(potential[, 1], 100)
TreatLocs = randSam[51:100]
TreatLocspop = potential[potential[, 1] %in% randSam[51:100], 2]
ContLocs = randSam[1:50]
ContLocspop = potential[potential[, 1] %in% randSam[1:50], 2]
RCTinfo <- list(Tstart = 50,
Tend = 54,
TreatLocs = TreatLocs,
ContLocs = ContLocs,
EffectiveCoverage = 0.9)
denmod_RCT = DEN.spatial.RCT(weekdates, sgdat, sgdat, unipix, pixdistmat, RCTinfo, nruns = 10)
# inspect results
nruns = 10
DEfigs <- rep(NA, nruns)
for(i in 1:nruns){
# attack rate untreated
ARU <- (sum(denmod_RCT$Control_infections[, i]) / sum(ContLocspop))
# attack rate treated
ART <- (sum(denmod_RCT$Treat_infections[, i]) / sum(TreatLocspop))
# calculate drug efficacy
DE = 100 * (ARU - ART) / ARU
DEfigs[i] = DE
}
# ! uncertainty = model uncertainty
# other areas of uncertainty to consider =
# site randomization, cluster size and ratio, drug effective coverage, timing of trial
boxplot(DEfigs, ylim = c(0, 100), main = "Drug Efficacy")
summary(DEfigs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.