cycle_rvtable: Repeated Resampling Utility

Description Usage Arguments Details Value Examples

View source: R/merging.R

Description

Repeat cycles of bootstrap resampling followed by density re-estimation for testing purposes.

Usage

1
cycle_rvtable(x, n, start = NULL, density.args, sample.args, keep = "all")

Arguments

x

an rvtable in distribution form only.

n

total number of iteratively estimated distributions to return, including the original from x.

start

usually NULL when first called and on subsequent recursive calls an integer representing which cycle to begin from in the updated rvtable.

density.args

optional arguments passed to density. If supplied, overrides the density.args attribute of x.

sample.args

optional arguments used when sampling. If supplied, overrides the sample.args attribute of x.

keep

character, iterations to retain in output table. Options are "all" (default) or "last".

Details

This function repeats cycles of bootstrap resampling from a distribution followed by distribution re-estimation n - 1 times. x must be a distribution-form rvtable and not a sample-form rvtable.

Value

an rvtable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(dplyr)
x <- data.frame(
  id1=rep(LETTERS[1:5], each=4),
  id2=factor(c("low", "high")),
  id3=rep(1:2, each=2),
  Val=rep(1:10, each=20), Prob=rep(sqrt(1:10), each=20)) %>% rvtable
cycle_rvtable(x, 2)
x %>% group_by(id1, id2) %>% cycle_rvtable(3, keep="last")

## End(Not run)

leonawicz/rvtable documentation built on May 21, 2019, 5:09 a.m.