This function calculates the overlap between observed and permuted data for two sets of comparisons. It computes the ratio of overlap between pairs of vectors (res1/res2 and pres1/pres2) after sorting the values.
calOverlaps(D, S, pD, pS, nrow, N, N_len, ssq, niter, overlaps, overlaps_P)
Numeric vector. Observed data values (e.g., differences).
Numeric vector. Standard errors or related values associated with the observed data.
Numeric vector. Permuted data values (e.g., differences).
Numeric vector. Standard errors or related values associated with the permuted data.
Integer. Number of rows in each block of data.
Integer vector. Number of top values to consider for overlap calculation.
Integer. Length of the N
vector.
Numeric. A small constant added to standard errors for stability.
Integer. Number of bootstrap samples or resampling iterations.
Numeric matrix. Matrix to store overlap results for observed data.
Numeric matrix. Matrix to store overlap results for permuted data.
A list containing two matrices: overlaps
for observed data and
overlaps_P
for permuted data.
The function calculates overlaps for two sets of comparisons: one for
observed data (res1/res2) and one for permuted data (pres1/pres2).For each
bootstrap sample, the function orders the two vectors being compared, then
calculates the proportion of overlap for the top N
values.