bootstrap_clusters: Resample clusters from an observed data set

Description Usage Arguments Value Examples

View source: R/bootstrap-clusters.R

Description

Resample clusters from an observed data set

Usage

1
bootstrap_clusters(clusters, n_boot = NULL)

Arguments

clusters

data frame of observed data with the following columns

cluster_id

cluster ID

other covariates

any other covariates

n_boot

number of clusters to resample. If NULL, will re-sample as many in original cluster

Value

data frame with new cluster_id variable but can be traced back to original cluster through the column original_id

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  data <- data.frame(cluster_id = c("a", "a", "a",
"b", "b",
"c", "c",
"d"),
x = c(1, 0, 1,
     1, 1,
     0, 1,
     0))
boot_clusters <- bootstrap_clusters(clusters = data)
boot_clusters

skgallagher/InfectionTrees documentation built on July 28, 2021, 2:14 p.m.