Description Usage Arguments Value See Also Examples
Generate a data frame representing a population of pop.size
individuals and record relevant disease diagnosed with and without screening
and overdiagnoses under simple dissemination of screening.
| 1 2 3 | population_setting(pop.size = 1e+05, onset.rate = 0.001, sojourn.min = 0,
  sojourn.max = 6, sensitivity = 0.5, overdiag.rate = 0.25,
  screen.start.year = 4, screen.stop.year = 30, followup.years = 30)
 | 
| pop.size | Number of individuals in the simulated population. | 
| 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. | 
| 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | library(plyr)
library(reshape)
population_incidence_3ways <- function(pop.size=1e5,
                                       screen.start.year=3){
    dset <- data.frame(sojourn.min=c(0, 0),
                       sojourn.max=c(12, 6),
                       sensitivity=0.5,
                       overdiag.rate=0.25)
    pset <- ddply(dset,
                  .(sojourn.min,
                    sojourn.max,
                    sensitivity,
                    overdiag.rate),
                  function(x)
                  with(x, population_setting(pop.size=pop.size,
                                             sojourn.min=sojourn.min,
                                             sojourn.max=sojourn.max,
                                             sensitivity=sensitivity,
                                             overdiag.rate=overdiag.rate,
                                             screen.start.year=screen.start.year))
                  )
    return(pset)
}
multipopulation_incidence_3ways <- function(pop.size=1e5,
                                            dissemination.pattern='default'){
    if(dissemination.pattern == 'default'){
        proportion <- c(0.05, 0.1, 0.15, 0.15, 0.05, 0.5)
        start.year <- c(2, 3, 4, 5, 6, 28)
        dissemination.name <- 'Cumulative uptake (years 2-6): 5%,15%,30%,45%,50%'
    } else {
        proportion <- c(0.1, 0.3, 0.1, 0.5)
        start.year <- c(2, 3, 4, 28)
        dissemination.name <- 'Cumulative uptake (years 2-4): 10%,40%,50%'
    }
    dissemination <- data.frame(pop.size=pop.size,
                                proportion=proportion,
                                start.year=start.year)
    stopifnot(with(dissemination, sum(proportion)) == 1)
    mpset <- ddply(dissemination,
                   .(proportion, start.year),
                   function(x){
                       with(x,
        population_incidence_3ways(pop.size=proportion*pop.size,
                                   screen.start.year=start.year))
                         })
    mpset <- ddply(mpset,
                   .(sojourn.min,
                     sojourn.max,
                     sensitivity,
                     overdiag.rate,
                     year),
                   summarize,
                   count_screen=sum(count_screen),
                   count_clinical=sum(count_clinical),
                   count_overdiag=sum(count_overdiag))
    mpset <- transform(mpset, dissemination=dissemination.name)
    return(mpset)
}
mpset_default <- multipopulation_incidence_3ways(dissemination.pattern='default')
mpset_variant <- multipopulation_incidence_3ways(dissemination.pattern='variant')
mpset_3ways <- rbind(mpset_default, mpset_variant)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.