boot_table: Bootstrap table.

Description Usage Arguments Value Examples

View source: R/bootstrap.R

Description

boot_table returns samples boostrapped from table tab supplied. Each column of the returned table is a boostrap trial of the corresponding column of the tab input table. The columns of the output table are multinomial samples with weights proportional to corresponding columns of tab.

Usage

1
2
boot_table(tab, n = 1, common_depth = FALSE, common_value = NULL,
  replace_zero = FALSE, replace_value = 1, round_values = FALSE)

Arguments

tab

(Required). A matrix or data.frame of numeric counts/weights.

n

(Optional). Default 1. An integer indicating the number of boostrap count tables to return.

common_depth

(Optional). Default FALSE. The value to which to normalize the boostrapped column sums. If not provided, do not normalize to a common depth.

common_value

(Optional) The depth to use when common_depth is TRUE. Defaults to the median of the column sums in tab.

replace_zero

(Optional) A logical specifying whether to replace zeros in x.

replace_value

(Optional) The value to replace zeros with, when replace_zero is TRUE; i.e. we add a small positive weight. Default value is 1.

round_values

(Optional). Default FALSE. A logical scalar. Should the boostrap counts be rounded to the nearest integer?

Value

n x dim(tab)[1] x dim(tab)[2] 3D array of samples boostrapped from tab.

Examples

1
2
3
4
5
6
7
x <- matrix(sample(1:1000, 30, replace = TRUE), 5, 6)
x[1, 4] <- 0; x[2, 5] <- 0; x[4, 6] <- 0; x[1, 5] <- 0
x
boot_table(x, n = 10)
boot_table(x, common_depth = 100)
boot_table(x, common_depth = 100, n = 10, round = TRUE)
boot_table(x, common_depth = 100, n = 10, replace_zero = 0.5)

krisrs1128/mvarVis documentation built on Oct. 13, 2019, 11:14 p.m.