Learn R Programming

detect (version 0.4-6)

hbootindex: Hierarchical bootstrap indices

Description

Generates hierarchical bootstrap indices.

Usage

hbootindex(groups, strata, B = 199)

Value

A matrix with bootstrapped indices, number of columns is B + 1. The column is a resample without replacement (random subsets can be selected without further reshuffling). Other elements contain indices according to rules described in Details section (these also randomly reshuffled).

Arguments

groups

group membership vector.

strata

strata, optional.

B

number of bootstrap iterations.

Author

Peter Solymos

Details

Resampling with replacement with weights proportional to the number of observations in each of the group level (unique values in groups).

Values of groups within levels (unique values) of strata are resampled independently of other strata levels.

Examples

Run this code
## equal group sizes
groups <- rep(1:4, each=5)
strata <- rep(1:2, each=10)
hbootindex(groups, strata, 3)

## unequal group sizes
groups <- groups[-c(5,9,10,11)]
strata <- strata[-c(5,9,10,11)]
hbootindex(groups, strata, 3)

Run the code above in your browser using DataLab