groups_by_filter: Stratify hypotheses based on increasing value of the...

View source: R/helpers.R

groups_by_filterR Documentation

Stratify hypotheses based on increasing value of the covariate

Description

Hypotheses are stratified into nbins different strata of (approximately) equal size based on increasing value of the covariate

Usage

groups_by_filter(covariate, nbins, ties.method = "random", seed = NULL)

Arguments

covariate

Numeric vector of ordinal covariates based on which the stratification will be done.

nbins

Integer, number of groups/strata into which p-values will be split based on covariate.

ties.method

Character specifying how ties are treated, see rank function.

seed

Integer, specifies random seed to be used when ties.method=="random".

Value

A factor with nbins different levels, each entry corresponds to the stratum the i-th hypothesis was assigned to.

Examples

 covariates <- runif(100)
 groups <- groups_by_filter(covariates,10)
 table(groups)

nignatiadis/IHW documentation built on Aug. 22, 2023, 2:11 p.m.