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.
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.
Value
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.