in reply to Re^3: Restore the original order of an array after sort and performing some funchtion on array values
in thread Restore the original order of an array after sort and performing some funchtion on array values
(a) sort these values in an decreasing order
0.9802138 0.9585124 0.8167950 0.6491767 0.5453980 0.4902384 0.4693030 0.4069490 0.2821822 0.1155778
(b) assign order to each above observation in a decreasing order, i.e.,
10 9 8 7 6 5 4 3 2 1
(c) then calculate
0.9802138*10/10 0.9585124*10/9 0.8167950*10/8 ..... 0 .1155778*10/1 (note that: the 10 in the numerator corresponds to the total number of tests conducted in this toy example, you should change this to the corresponding actual number of tests when you do real data analysis. Also the order assignment will start with the total number of tests and decrease to 1.)
You will obtain the following
0.9802138 1.0650138 1.0209938 0.9273953 0.9089967 0.9804768 1.1732575 1.3564967 1.4109110 1.1557780
(d) then do the the cumulative minimum adjustment, i.e.
since 0.9802138<1.0650138, replace 1.0650138 with 0.9802138,
then among the first three values 0.9802138, 0.9802138, 1.0209938, 0.9802138 is smallest, replace 1.0209938 with 0.9802138
then among the first four values 0.9802138, 0.9802138, 0.9802138, 0.9273953, 0.9273953 is the smallest, and the fourth value will not be changed
similarly, the fifth value will not be changed and all the rest of values will be changed to 0.9089967
Finally you should have 0.9802138, 0.9802138, 0.9802138, 0.9273953 0.9089967 0.9089967 0.9089967 0.9089967 0.9089967 0.9089967
rearrange these value according to the original order of p-value,
0.5453980 0.4902384 0.8167950 0.2821822 0.4693030 0.6491767 0.9802138 0.1155778 0.9585124 0.4069490
[6] [5] [8] [2] [4] [7] [10] [1] + [9] [3]
then you will obtain the following values
0.9089967 0.9089967 0.9802138 0.9089967 0.9089967 0.9273953 0.9802138 0.9089967 0.9802138 0.9089967
then you compare each of these values (in red) with 1, if it is greater than 1, then replace that value with 1. Since in this particular example, all the above values (in red) are less than 1, your final BH adjusted q-values are
0.9089967 0.9089967 0.9802138 0.9089967 0.9089967 0.9273953 0.9802138 0.9089967 0.9802138 0.9089967
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Restore the original order of an array after sort and performing some funchtion on array values
by BrowserUk (Patriarch) on Mar 03, 2010 at 23:35 UTC | |
by sesemin (Beadle) on Mar 04, 2010 at 00:29 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2010 at 01:21 UTC |