build_simpop: Build a simulated population by bootstrapping from a list

Description Usage Arguments Value Examples

Description

Cantrance remnant; use row IDs to reconstruct a single bootstrap of data

Usage

1
build_simpop(datalist, rowlist, sim)

Arguments

datalist

List of data frames containing the data to be bootstrapped then combined into a single data frame. Each data frame should refer to a different characterisic of individuals in the population, e.g. 1st data frame is sex, 2nd data frame is age

rowlist

List of data frames containing row numbers for bootstrapping the data in datalist. Row numbers of rowlist[[i]] refer to datalist[[i]]

sim

Simulation number, i.e. which column of rowlist elements to use

Value

Data frame with characteristics from datalist in proportion to their appearance in rowlist[[sim]]

Examples

1
2
3
4
5
6
7
8
9
# Possible characteristics
pop <- list(data.frame(male=0),
            data.frame(age=c(20,30,40)))
# Actual characteristics for each of 2 sims, specified by rows, for pop size = 10
rows <- list(matrix(1, nrow=10, ncol=2),
             matrix(sample.int(3, 20, replace=TRUE), nrow=10, ncol=2))
# Population using sim 1
build_simpop(pop, rows, 1)
build_simpop(pop, rows, 2)

cancerpolicy/bcimodel documentation built on June 30, 2019, 12:39 a.m.