Skip to content

vlt.stats.corrcoefResample

 CORRCOEFRESAMPLE Calculates the correlation coefficient and its significance using resampling.

    [RHO, RHO_PERM, PERCENTILE] = vlt.stats.corrcoefResample(X, Y, N, ...)
    calculates the Pearson correlation coefficient RHO between vectors X and Y.
    It then performs N resamples by permuting X and calculating the
    correlation coefficient with Y for each permutation, storing the results
    in RHO_PERM. This loop is executed in parallel using PARFOR.

    Finally, it calculates the percentile of the actual RHO within the
    distribution of RHO_PERM.

    Inputs:
        X         - A vector of data.
        Y         - Another vector of data with the same length as X.
        N         - The number of resamples to perform.
        options   - (Optional) Name-value pairs:
                    'useRanks' (default false) - If true, compute ranks of X and Y
                    before analysis (Spearman correlation).

    Outputs:
        rho       - The Pearson correlation coefficient between X and Y.
        rho_perm  - A vector of N correlation coefficients calculated from
                    permutations of X.
        percentile - The percentile of RHO within the distribution of RHO_PERM.