sffdr: Estimate the functional p-values, q-values, and local false...

View source: R/sffdr.R

sffdrR Documentation

Estimate the functional p-values, q-values, and local false discovery rates given a set of p-values and informative variables

Description

Estimate the functional p-values, q-values, and local false discovery rates given a set of p-values and informative variables. The functional p-values is mapping from the functional q-value (FDR-based measure) to a p-value for type I error rate control.

Usage

sffdr(
  p.value,
  fpi0,
  surrogate = NULL,
  indep_snps = NULL,
  monotone.window = NULL,
  epsilon = 1e-15,
  nn = NULL,
  fp_ties = TRUE,
  ...
)

Arguments

p.value

A vector of p-values.

fpi0

An estimate of the function proportion of null tests using the fpi0est function.

surrogate

A surrogate variable that compresses more than one informative variables. Default is NULL. If fpi0 is specified and surrogate is NULL then fpi0 is used as the surrogate variable.

indep_snps

A boolean vector (same size as p) specifying the set of independent tests. Default is NULL and all tests are treated independently.

monotone.window

Enforce monotonicity at specified step size. Default is NULL.

epsilon

A numerical value the truncation for the p-values during density estimation. Default is 1e-15. You may want to consider decreasing this value if there are a substantial number of small p-values.

nn

A numerical value specifying the nearest neighbor parameter in kernelEstimator. Default is NULL.

fp_ties

A boolean specifying whether ties should be broken using the ordering of the p-values when calculating the fp-values. Only impacts the tests when the local FDR is tied. Default is TRUE.

...

Additional arguments passed to kernelEstimator.

Details

The function fpi0est should be called externally to estimate the functional proportion of null tests given the set of informative variables. The surrogate functional FDR methodology builds from the functional FDR methodology and implements some of the functions from the package.

Value

A list of object type "sffdr" containing:

pvalues

A vector of the original p-values.

fpvalues

A vector of the estimated functional p-values.

fqvalues

A vector of the estimated functional q-values.

flfdr

A vector of the estimated functional local FDR values.

pi0

An vector of the original functional proportion of null tests.

density

An object containing the kernel density estimates from kernelEstimator.

Author(s)

Andrew J. Bass

See Also

fpi0est, plot.sffdr

Examples


# import data
data(bmi)

# separate main p-values and conditioning p-values
p <- sumstats$bmi
z <- as.matrix(sumstats[, -1])

# apply pi0_model to create model
knots <- c(0.005, 0.01, 0.025, 0.05, 0.1)
fmod <- pi0_model(z, knots = knots)

# estimate functional pi0
fpi0_out <- fpi0est(p, z = fmod$zt, pi0_model = fmod$fmod)
fpi0 <- fpi0_out$fpi0

# apply sffdr
# Note all tests are independent see 'indep_snps' argument
# The data has very small p-values, set epsilon to min of p
sffdr_out <- sffdr(p, fpi0, epsilon = min(p))

# Plot significance results
plot(sffdr_out, rng = c(0, 5e-4))

# Functional P-values, Q-values, and local FDR
fp <- sffdr_out$fpvalues
fq <- sffdr_out$fqvalues
flfdr <- sffdr_out$flfdr


sffdr documentation built on April 4, 2025, 1:41 a.m.