kStepMAlgorithm: k-StepM Algorithm for Hypothesis Testing
Description
This function implements the k-stepM algorithm for multiple hypothesis testing.
It tests each hypothesis using the critical value calculated from the ECDF
of the k-max differences, updating the critical value, and iterating until all hypotheses
are tested.
A list containing two elements: 'signif', a logical vector indicating which hypotheses
are rejected, and 'cv', a numeric vector of critical values used for each hypothesis.
Arguments
original_stats
A numeric vector of original test statistics for each hypothesis.
bootstrap_stats
A numeric matrix of bootstrap test statistics, with rows representing
bootstrap samples and columns representing hypotheses.
num_hypotheses
An integer specifying the total number of hypotheses.
alpha
A numeric value specifying the significance level.
k
An integer specifying the threshold number for controlling the k-familywise error rate.
References
Romano, Joseph P., Azeem M. Shaikh, and Michael Wolf. "Formalized data snooping
based on generalized error rates." Econometric Theory 24.2 (2008): 404-447.