# mafdr

Estimate false discovery rate (FDR) for multiple hypothesis testing

## Syntax

```FDR = mafdr(PValues)[FDR, Q] = mafdr(PValues)[FDR, Q, Pi0] = mafdr(PValues)[FDR, Q, Pi0, R2] = mafdr(PValues)FDR = mafdr(PValues, ...'BHFDR', BHFDRValue, ...)... = mafdr(PValues, ...'Lambda', LambdaValue, ...)... = mafdr(PValues, ...'Method', MethodValue, ...)... = mafdr(PValues, ...'Showplot', ShowplotValue, ...)```

## Input Arguments

`PValues`

Either of the following:

`BHFDRValue`Controls the use of the linear step-up (LSU) procedure originally introduced by Benjamini and Hochberg, 1995 (instead of the procedure introduced by Storey, 2002). Choices are `true` or `false` (default).
 Note:   If you set `BHFDRValue` to `true`, then: `Lambda` and `Method` properties are ignored. There can be only one output argument, `FDR`.
`LambdaValue`Specifies lambda, λ, the tuning parameter used to estimate the a priori probability that the null hypothesis, $\stackrel{^}{\pi }0\left(\lambda \right)$, is true. `LambdaValue` can be either:
• A single value that is `> 0` and ```< 1```.

• A vector of four or more values. Each value must be ```> 0``` and `< 1`.

 Tip   The series of values can be expressed by a colon operator with the form `[first:incr:last]`, where `first` is the first value in the series, `incr` is the increment, and `last` is the last value in the series.
Default `LambdaValue` is the series of values `[0.01:0.01:0.95]`.
 Note:   If you set `LambdaValue` to a single value, the `Method` property is ignored. If you set `LambdaValue` to a vector of values, `mafdr` chooses the optimal value using the method specified by the `Method` property.
`MethodValue`String that specifies a method to choose lambda, λ, the tuning parameter, from `LambdaValue`, when it is a vector. Choices are:
• `'bootstrap'` (default)

• `'polynomial'`

 Note:   `MethodValue` must be `'polynomial'` to return the fourth output argument, `R2`.
`ShowplotValue`

Property to display two plots:

• Plot of the estimated a priori probability that the null hypothesis, $\stackrel{^}{\pi }0\left(\lambda \right)$, is true versus the tuning parameter, lambda, λ, with a cubic polynomial fitting curve

• Plot of q-values versus p-values

Choices are `true` or `false` (default).

 Note:   If you set the `BHFDR` property to `true`, only the second plot displays.

## Output Arguments

 `FDR` One of the following:Column vector of positive FDR (pFDR) values (if `PValues` is a column vector).DataMatrix object containing positive FDR (pFDR) values and the same row names as `PValues` (if `PValues` is a DataMatrix object). `Q` Column vector of q-values, which are measures of hypothesis testing error for each observation in `PValues`. `Pi0` Estimated a priori probability that the null hypothesis, $\stackrel{^}{\pi }0$, is true. `R2` Square of the correlation coefficient.

## Description

`FDR = mafdr(PValues)` estimates a positive FDR (pFDR) value for each value in `PValues`, a column vector or DataMatrix object containing p-values for each feature (for example, gene) in a data set, using the procedure introduced by Storey, 2002. `FDR` is a column vector or a DataMatrix object containing positive FDR (pFDR) values.

`[FDR, Q] = mafdr(PValues)` also returns a q-value for each p-value in `PValues`, using the procedure introduced by Storey, 2002. `Q` is a column vector containing measures of hypothesis testing error for each observation in `PValues`.

`[FDR, Q, Pi0] = mafdr(PValues)` also returns `Pi0`, the estimated a priori probability that the null hypothesis, $\stackrel{^}{\pi }0$, is true, using the procedure introduced by Storey, 2002.

`[FDR, Q, Pi0, R2] = mafdr(PValues)` also returns `R2`, the square of the correlation coefficient, using the procedure introduced by Storey, 2002, and the `polynomial` method to choose the tuning parameter, lambda, λ.

```... = mafdr(PValues, ...'PropertyName', PropertyValue, ...)``` calls `mafdr` with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each `PropertyName` must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:

```FDR = mafdr(PValues, ...'BHFDR', BHFDRValue, ...)``` controls the use of the linear step-up (LSU) procedure originally introduced by Benjamini and Hochberg, 1995 (instead of the procedure introduced by Storey, 2002), to estimate an FDR-adjusted p-value for each value in `PValues`. Choices are `true` or `false` (default).

 Note:   If you set `BHFDRValue` to `true`, then: `Lambda` and `Method` properties are ignored. There can be only one output argument, `FDR`.

```... = mafdr(PValues, ...'Lambda', LambdaValue, ...)``` specifies lambda, λ, the tuning parameter used to estimate the a priori probability that the null hypothesis, $\stackrel{^}{\pi }0\left(\lambda \right)$, is true. `LambdaValue` can be either:

• A single value that is `> 0` and ```< 1```.

• A vector of four or more values. Each value must be ```> 0``` and `< 1`.

 Tip   The series of values can be expressed by a colon operator with the form `[first:incr:last]`, where `first` is the first value in the series, `incr` is the increment, and `last` is the last value in the series.

Default `LambdaValue` is the series of values `[0.01:0.01:0.95]`.

 Note:   If you set `LambdaValue` to a single value, the `Method` property is ignored. If you set `LambdaValue` to a vector of values, `mafdr` chooses the optimal value using the method specified by the `Method` property.

```... = mafdr(PValues, ...'Method', MethodValue, ...)``` specifies a method to choose lambda, λ, the tuning parameter, from `LambdaValue`, when it is a vector. Choices are `bootstrap` (default) or `polynomial`.

 Note:   `MethodValue` must be `'polynomial'` to return the fourth output argument, `R2`.

```... = mafdr(PValues, ...'Showplot', ShowplotValue, ...)``` controls the display of two plots:

• Plot of the estimated a priori probability that the null hypothesis, $\stackrel{^}{\pi }0\left(\lambda \right)$, is true versus the tuning parameter, lambda, λ, with a cubic polynomial fitting curve

• Plot of q-values versus p-values

Choices are `true` or `false` (default).

 Note:   If you set the `BHFDR` property to `true`, only the second plot displays.

## Examples

1. Load the MAT-file, included with the Bioinformatics Toolbox™ software, that contains Affymetrix® data from a prostate cancer study, specifically probe intensity data from Affymetrix HG-U133A GeneChip® arrays. The two variables in the MAT-file, `dependentData` and `independentData`, are two matrices of gene expression values from two experimental conditions.

`load prostatecancerexpdata`
2. Use the `mattest` function to calculate p-values for the gene expression values in the two matrices.

`pvalues = mattest(dependentData, independentData, 'permute', true);`
3. Use the `mafdr` function to calculate positive FDR values and q-values for the gene expression values in the two matrices and plot the data.

`[fdr, q] = mafdr(pvalues, 'showplot', true);`

The `prostatecancerexpdata.mat` file used in this example contains data from Best et al., 2005.

## References

[1] Best, C.J.M., Gillespie, J.W., Yi, Y., Chandramouli, G.V.R., Perlmutter, M.A., Gathright, Y., Erickson, H.S., Georgevich, L., Tangrea, M.A., Duray, P.H., Gonzalez, S., Velasco, A., Linehan, W.M., Matusik, R.J., Price, D.K., Figg, W.D., Emmert-Buck, M.R., and Chuaqui, R.F. (2005). Molecular alterations in primary prostate cancer after androgen ablation therapy. Clinical Cancer Research 11, 6823–6834.

[2] Storey, J.D. (2002). A direct approach to false discovery rates. Journal of the Royal Statistical Society 64(3), 479–498.

[3] Storey, J.D., and Tibshirani, R. (2003). Statistical significance for genomewide studies. Proc Nat Acad Sci 100(16), 9440–9445.

[4] Storey, J.D., Taylor, J.E., and Siegmund, D. (2004). Strong control conservative point estimation and simultaneous conservative consistency of false discovery rates: A unified approach. Journal of the Royal Statistical Society 66, 187–205.

[5] Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. Journal of the Royal Statistical Society 57, 289–300.