Package 'APFr'

Title: Multiple Testing Approach using Average Power Function (APF) and Bayes FDR Robust Estimation
Description: Implements a multiple testing approach to the choice of a threshold gamma on the p-values using the Average Power Function (APF) and Bayes False Discovery Rate (FDR) robust estimation. Function apf_fdr() estimates both quantities from either raw data or p-values. Function apf_plot() produces smooth graphs and tables of the relevant results. Details of the methods can be found in Quatto P, Margaritella N, et al. (2019) <doi:10.1177/0962280219844288>.
Authors: Nicolò Margaritella [cre, aut], Piero Quatto [aut]
Maintainer: Nicolò Margaritella <[email protected]>
License: GPL-3
Version: 1.0.2
Built: 2024-11-13 03:11:58 UTC
Source: https://github.com/cran/APFr

Help Index


Implementation of APF and FDR robust estimation

Description

apf_fdr returns robust estimates of the Average Power Function (APF) and Bayes False Discovery Rate (FDR) for each value of the threshold Gamma on the p-value and Tau on the correlation coefficient.

Usage

apf_fdr(data, type = "datf", corr = "spearman", lobs = 0,
  seed = 111, gamm = c(1e-04, 0.1, 0.002))

Arguments

data

Either a vector, matrix or dataframe.

type

Set "datf" if data is a matrix or dataframe containing the raw data (columns); "pvl" for a vector of p-values.

corr

The type of correlation to use when type = "datf". It can be set to either "spearman" or "pearson".

lobs

When type = "pvl", it indicates the number of datapoints used to compute the correlations.

seed

A seed (natural number) for the resampling.

gamm

The threshold gamma on the p-values to explore (typically \le 0.05 or 0.1). A min, max and step length value need to be set.

Value

A list with four elements. A vector APF_gamma containing the robust estimates of APF (5th quantiles) for all the gamma values set in gamm. A vector FDR_gamma with the robust estimates of Bayes FDR (95th quantiles). A vector tau_gamma with the correlation coefficients tau for each gamma value explored and another vector with the relative values gamma (gammaval).

References

Quatto, P, Margaritella, N, et al. Brain networks construction using Bayes FDR and average power function. Stat Methods Med Res. Published online May 14th, 2019; DOI:10.1177/0962280219844288.

Examples

data("Ex1")
APF_lst <- apf_fdr(Ex1,"pvl",lobs=100)
# The example uses the dataset Ex1 (in the APFr package) which is
# a vector of 100 p-values. The number of datapoints used to
# compute each p-value in this example is set to 100. As a result,
# a list of 4 objects is returned.

Generate smooth graphs for the APF and FDR estimates

Description

apf_plot returns a graph with Average Power Function (APF), Bayes False Discovery Rate (FDR) and APF vs. FDR. In addition, when tab = TRUE, a table containing APF, FDR, tau and gamma values for a selected subset of APF and FDR is printed.

Usage

apf_plot(APF_lst, tab = TRUE, APF_inf = 0.5, FDR_sup = 0.05)

Arguments

APF_lst

The output from the apf_fdr function.

tab

If TRUE, a table with relevant values of APF, FDR, tau and gamma is printed.

APF_inf

Sets the minimum value of APF to appear in the table when tab = TRUE.

FDR_sup

Sets the maximum value of Bayes FDR to appear in the table when tab = TRUE.

Value

Smooth graphs for APF vs Gamma (left), FDR vs Gamma (centre) and APF vs FDR (right). Regions where FDR \le FDR_sup and APF \ge APF_inf (if presents) are highlighted in yellow and printed in a table (if tab = TRUE) together with the relative values of gamma and tau.

References

Quatto, P, Margaritella, N, et al. Brain networks construction using Bayes FDR and average power function. Stat Methods Med Res. Published online May 14th, 2019; DOI:10.1177/0962280219844288.

Examples

data("Ex2")
apf_plot(Ex2)
# Ex2 is an example of output obtained
# from the apf_fdr() function.

Example dataset 1

Description

A dataset containing 100 simulated p-values, 70 from a N(2,1) and 30 from a N(0,1).

Usage

Ex1

Format

A vector containing 100 p-values.

References

Quatto, P, Margaritella, N, et al. Brain networks construction using Bayes FDR and average power function. Stat Methods Med Res. Published online May 14th, 2019; DOI:10.1177/0962280219844288.

Examples

data(Ex1)

Example 2

Description

A list containing 4 vectors. This is an example of output obtained with apf_fdr() to use with apf_plot().

Usage

Ex2

Format

A list containing 4 vectors called APF_gamma, FDR_gamma, tau_gamma, gammaval.

References

Quatto, P, Margaritella, N, et al. Brain networks construction using Bayes FDR and average power function. Stat Methods Med Res. Published online May 14th, 2019; DOI:10.1177/0962280219844288.

Examples

data(Ex2)