This function optimizes parameters by calculating overlaps between observed and permuted data for multiple values of a smoothing constant (ssq) and a single-label replicate (SLR) comparison.

Optimizing(niter, ssq, N, D, S, pD, pS, verbose)

Arguments

niter

Integer. Number of bootstrap samples or resampling iterations.

ssq

Numeric vector. Smoothing constants to be evaluated.

N

Integer vector. Number of top values to consider for overlap calculation.

D

Numeric matrix. Observed data values.

S

Numeric matrix. Standard errors or related values for observed data.

pD

Numeric matrix. Permuted data values.

pS

Numeric matrix. Standard errors or related values for permuted data.

verbose

Logical. If TRUE, progress messages will be displayed.

Value

A list containing the optimal parameters:

  • a1: Optimal smoothing constant or 1 for SLR.

  • a2: SLR flag (1 if smoothing constant is optimal, 0 if SLR is optimal).

  • k: Optimal number of top values to consider for overlap.

  • R: Optimal overlap value.

  • Z: Optimal z-score.

  • ztable: Matrix of z-scores for all evaluated parameters.

Details

The function calculates overlaps for a range of smoothing constants and identifies the optimal set of parameters by maximizing a z-score-based metric, which compares the overlap of observed data to permuted data. It computes overlap matrices for both observed (D and S) and permuted (pD and pS) data and returns the optimal parameters based on the highest z-score.