Description Usage Arguments Value See Also Examples
Generate a data frame representing a screening trial of arm.size
individuals in each arm and record relevant disease diagnosed with and
without screening and overdiagnoses.
| 1 2 3 4 | trial_setting(arm.size = 50000, onset.rate = 0.001, sojourn.min = 0,
  sojourn.max = 6, sensitivity = 0.5, attendance = 0.8,
  overdiag.rate = 0.25, screen.start.year = 1, screen.stop.year = 30,
  followup.years = 30)
 | 
| arm.size | Number of individuals in each trial arm. | 
| onset.rate | Annual incidence rate of relevant preclinical disease. | 
| sojourn.min | Shortest relevant preclinical duration. | 
| sojourn.max | Longest relevant preclinical duration. | 
| sensitivity | Screen test episode sensitivity. | 
| attendance | Proportion of participants who attend a screen test. | 
| overdiag.rate | Proportion of screen detections that are overdiagnosed. | 
| screen.start.year | Year of follow-up at which screening starts. | 
| screen.stop.year | Year of follow-up at which screening stops. | 
| followup.years | Number of years of follow-up. | 
A data frame of simulated disease incidence organized by year of preclinical onset, sojourn time, and year of diagnosis.
| 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 42 43 44 | library(plyr)
library(reshape)
trial_incidence_3types <- function(){
    tset <- data.frame(sojourn.min=0,
                       sojourn.max=6,
                       sensitivity=0.5,
                       attendance=0.8,
                       overdiag.rate=0.25)
    tset <- rbind(transform(tset, screen.start.year=1,
                                  screen.stop.year=5,
                                  type='screen-stop'),
                  transform(tset, screen.start.year=1,
                                  screen.stop.year=30,
                                  type='screen-continue'),
                  transform(tset, screen.start.year=5,
                                  screen.stop.year=30,
                                  type='screen-continue-delay'))
    tset <- ddply(tset,
                  .(sojourn.min,
                    sojourn.max,
                    sensitivity,
                    attendance,
                    overdiag.rate,
                    screen.start.year,
                    screen.stop.year,
                    type),
                  function(x)
                  with(x, trial_setting(sojourn.min=sojourn.min,
                                        sojourn.max=sojourn.max,
                                        sensitivity=sensitivity,
                                        attendance=attendance,
                                        overdiag.rate=overdiag.rate,
                                        screen.start.year=screen.start.year,
                                        screen.stop.year=screen.stop.year))
                  )
    newscreen <- subset(tset, arm == 'screen' & type == 'screen-continue')
    newcontrol <- subset(tset, arm == 'screen' & type == 'screen-continue-delay')
    newscreen <- transform(newscreen, type='screen-continue-control-start')
    newcontrol <- transform(newcontrol, arm='control', type='screen-continue-control-start')
    tset <- subset(tset, type != 'screen-continue-delay')
    tset <- rbind(tset, newscreen, newcontrol)
    return(tset)
}
tset_3types <- trial_incidence_3types()
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.