README.md (3383B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2020 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # padjust 22 23 > Adjust supplied p-values for multiple comparisons. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var padjust = require( '@stdlib/stats/padjust' ); 31 ``` 32 33 #### padjust( pvals, method\[, comparisons] ) 34 35 Adjusts supplied p-values for multiple comparisons via a specified method. 36 37 ```javascript 38 var out = padjust( [ 0.1496, 0.0275, 0.3053, 0.1599, 0.2061 ], 'bonferroni' ); 39 // returns [ 0.748, ~0.138, ..., ~0.799, 1 ] 40 ``` 41 42 The `method` parameter can be one of the following values: 43 44 - **bh**: Benjamini-Hochberg procedure controlling the False Discovery Rate (FDR). 45 - **bonferroni**: Bonferroni correction fixing the family-wise error rate by multiplying the p-values with the number of comparisons. The Bonferroni correction is usually a too conservative adjustment compared to the others. 46 - **by**: Procedure by Benjamini & Yekutieli for controlling the False Discovery Rate (FDR) under dependence. 47 - **holm**: Hommel's method controlling family-wise error rate. It is uniformly more powerful than the Bonferroni correction. 48 - **hommel**: Hommel's method, which is valid when hypothesis tests are independent. It is more expensive to compute than the other methods. 49 50 ```javascript 51 var pvalues = [ 0.319, 0.201, 0.4, 0.374, 0.113 ]; 52 var out = padjust( pvalues, 'holm' ); 53 // returns [ ~0.957, 0.804, ..., ~0.957, ~0.565 ] 54 55 out = padjust( pvalues, 'bh' ); 56 // returns [ 0.4, 0.4, ..., 0.4, 0.4 ] 57 ``` 58 59 By default, the number of comparisons for which the p-values should be 60 corrected is equal to the number of provided p-values. Alternatively, it is 61 possible to set `comparisons` to a number greater than the length of 62 `pvals`. In that case, the methods assume `comparisons - pvals.length` 63 unobserved p-values that are greater than all observed p-values (for Holm's 64 method and the Bonferroni correction) or equal to `1` for the remaining methods. 65 66 ```javascript 67 var pvalues = [ 0.319, 0.201, 0.4, 0.374, 0.113 ]; 68 var out = padjust( pvalues, 'bh', 10 ); 69 // returns [ 0.8, 0.8, ..., 0.8, 0.8 ] 70 ``` 71 72 </section> 73 74 <!-- /.usage --> 75 76 <section class="examples"> 77 78 ## Examples 79 80 <!-- eslint no-undef: "error" --> 81 82 ```javascript 83 var padjust = require( '@stdlib/stats/padjust' ); 84 85 var pvalues = [ 0.008, 0.03, 0.123, 0.6, 0.2 ]; 86 87 var out = padjust( pvalues, 'bh' ); 88 // returns [ 0.04, 0.075, ~0.205, 0.6, 0.25 ] 89 90 out = padjust( pvalues, 'bonferroni' ); 91 // returns [ 0.04, 0.15, 0.615, 1.0, 1.0 ] 92 93 out = padjust( pvalues, 'by' ); 94 // returns [ ~0.457, ~0.856, 1.0, 1.0, 1.0 ] 95 96 out = padjust( pvalues, 'holm' ); 97 // returns [ 0.2, 0.6, 1.0, 1.0, 1.0 ] 98 99 out = padjust( pvalues, 'hommel' ); 100 // returns [ 0.16, 0.6, 1.0, 1.0, 1.0 ] 101 ``` 102 103 </section> 104 105 <!-- /.examples --> 106 107 <section class="references"> 108 109 </section> 110 111 <!-- /.references --> 112 113 <section class="links"> 114 115 </section> 116 117 <!-- /.links -->