permute_within_two_condition_bins: Internal Utility Function for Within-Bin Permutation With Two...

View source: R/ComputePermutation.R

permute_within_two_condition_binsR Documentation

Internal Utility Function for Within-Bin Permutation With Two Conditions

Description

Permutes the values of one vector within joint bins defined by two condition vectors. This function is intended for internal use only and should not be accessed by package users.

The two condition vectors are each split into quantile-based bins. Joint bins are then defined by the combination of the two bin assignments. Values of the target vector are randomly permuted only within each joint bin. This preserves the approximate relationship between the target vector and both condition variables while breaking the original sample-wise ordering within local strata.

Usage

permute_within_two_condition_bins(y, condi1, condi2, bin = 8)

Arguments

y

A vector to be permuted.

condi1

A numeric vector used to define the first set of bins.

condi2

A numeric vector used to define the second set of bins.

bin

An integer specifying the number of bins for each condition vector. Default is 8.

Value

A vector with the same length as 'y', where values have been permuted within joint bins defined by 'condi1' and 'condi2'.


conMItion documentation built on June 17, 2026, 5:06 p.m.