|
1 | 1 | classdef ResultRank < handle |
2 | | - % RESULTRANK Class to take permutation results and rank them. This used to be done incrementally. It"s a little hacky, beware |
3 | | - % This class does a classic permutation based ranking of results. The "observed" (nonpermuted) result is appended to the results |
4 | | - % of all the permuted results. All of these results are sorted and then searched for the observed result. Where this result is located |
5 | | - % in the sorted array ends up being the p-value. |
| 2 | + % Ranker to calculate *p*-values from permutation testing |
| 3 | + % |
| 4 | + % :param permuted_network_results: The NetworkTestResult object from permutation test |
| 5 | + % :param number_of_network_pairs: The number of network pairs for the Brain Atlas used |
| 6 | + % :return |
6 | 7 |
|
7 | 8 | properties |
8 | | - nonpermuted_network_results % The results from the network tests (these are the ones being tested) |
9 | | - permuted_network_results % The results from the network tests with all the paramters permuted over and over |
| 9 | + nonpermuted_network_results % The results from the network level test (NetworkTestResult object) |
| 10 | + permuted_network_results % The network level test results for each permutation |
10 | 11 | number_of_network_pairs % The number of network pairs in the atlas being used |
11 | 12 | end |
12 | 13 |
|
13 | 14 | properties (Dependent) |
14 | | - permutations |
15 | | - number_of_networks |
| 15 | + permutations |
| 16 | + number_of_networks |
16 | 17 | end |
17 | 18 |
|
18 | 19 | methods |
|
53 | 54 | end |
54 | 55 |
|
55 | 56 | function ranking = uncorrectedRank(obj, test_method, permutation_results, no_permutation_results, ranking_statistic,... |
56 | | - probability, ranking) |
57 | | - |
| 57 | + probability, ranking) |
| 58 | + % Performs ranking of observed result among all results (all permutations plus itself) |
| 59 | + % |
| 60 | + % :param test_method: The method of the test being ranked (full connectome or within network pair) |
| 61 | + % :param permutation_results: The test result for all permutations |
| 62 | + % :param no_permutation_results: The observed test result |
| 63 | + % :param ranking_statistic: The statistic used in ranking for each test |
| 64 | + % :param probability: The name of the *p*-value (single_sample or two_sample) |
| 65 | + % :param ranking: The NetworkTestResult object to place the results |
| 66 | + % :return: The same NetworkTestResult object with ranking results |
| 67 | + |
| 68 | + |
58 | 69 | for index = 1:numel(no_permutation_results.(strcat("uncorrected_", probability)).v) |
59 | 70 | combined_probabilities = [... |
60 | 71 | permutation_results.(strcat((probability), "_permutations")).v(index, :),... |
|
86 | 97 |
|
87 | 98 |
|
88 | 99 | function ranking = winklerMethodRank(obj, test_method, permutation_results, no_permutation_results, ranking_statistic,... |
89 | | - probability, ranking) |
| 100 | + probability, ranking) |
| 101 | + % Ranks the observed result using method described by Winkler to correct for FWER |
| 102 | + % |
| 103 | + % :param test_method: The method of the test being ranked (full connectome or within network pair) |
| 104 | + % :param permutation_results: The test result for all permutations |
| 105 | + % :param no_permutation_results: The observed test result |
| 106 | + % :param ranking_statistic: The statistic used in ranking for each test |
| 107 | + % :param probability: The name of the *p*-value (single_sample or two_sample) |
| 108 | + % :param ranking: The NetworkTestResult object to place the results |
| 109 | + % :return: The same NetworkTestResult object with ranking results |
| 110 | + |
90 | 111 | winkler_probability = strcat("winkler_", probability); |
91 | 112 | max_statistic_array = max(abs(permutation_results.(strcat(ranking_statistic, "_permutations")).v)); |
92 | 113 | for index = 1:numel(no_permutation_results.(strcat("uncorrected_", probability)).v) |
|
104 | 125 | end |
105 | 126 |
|
106 | 127 | function ranking = westfallYoungMethodRank(obj, test_method, permutation_results, no_permutation_results, ranking_statistic,... |
107 | | - probability, ranking) |
| 128 | + probability, ranking) |
| 129 | + % Ranks the observed result using method described by Westfall and Young to correct for FWER |
| 130 | + % |
| 131 | + % :param test_method: The method of the test being ranked (full connectome or within network pair) |
| 132 | + % :param permutation_results: The test result for all permutations |
| 133 | + % :param no_permutation_results: The observed test result |
| 134 | + % :param ranking_statistic: The statistic used in ranking for each test |
| 135 | + % :param probability: The name of the *p*-value (single_sample or two_sample) |
| 136 | + % :param ranking: The NetworkTestResult object to place the results |
| 137 | + % :return: The same NetworkTestResult object with ranking results |
108 | 138 |
|
109 | 139 | % sort statistics in ascending order |
110 | 140 | [sorted_no_permutation_results, sorted_statistic_indexes] = sort(... |
|
0 commit comments