estimate_fpi0: Estimate the functional proportion

Description Usage Arguments Details Value Examples

View source: R/estimate_fpi0.R

Description

Estimate the functional proportion pi0(z) when it is not independent of the informative variable z.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
estimate_fpi0(
  p,
  z0,
  lambda = seq(0.4, 0.9, 0.1),
  method = "gam",
  df = 3,
  breaks = 5,
  maxit = 1000,
  ...
)

Arguments

p

A vector of p-values

z0

A vector of observations from the informative variable, of the same length as p

lambda

Choices of the tuning parameter "lambda", which are by default .4, .5, ..., .9

method

Method for estimating the functional proportion pi0(z), which should be either "gam" (default), "glm", "kernel" or "bin"

df

Degrees of freedom to use for the splines in "gam" method

breaks

Either a number of (evenly spaced) break points for "bin" method, or a vector of break points (from 0 to 1) to use for bins

maxit

Max iterations to perform when using the "glm" method.

...

Additional arguments to "glm", "gam" or "kernel" method

Details

Assume the random variable z0 may affect the power of a statistical test (that induces the p-values) or the likelihood of a true null hypothesis. The m observations z0_i, i=1,...,m of z0 are quantile transformed into z_i, i=1,...,m such that z_i = rank(z0_i) / m, where rank(z0_i) is the rank of z0_i among z0_i, i=1,...,m. Consequently, z_i, i=1,...,m are approximately uniformly distributed on the interval [0,1]. When z_i, i=1,...,m are regarded as observations from the random variable z, then z is approximately uniformly distributed on [0,1]. Namely, z0 has been quantile transformed into z, and they are equivalent. Further, z or z0 is referred to as the informative variable.

In short, the "glm", "gam", and "kernel" methods attempt to estimate:

pi_0(z) = Pr(p>lambda|z)/(1-lambda)

The "glm" and "gam" approaches define an indicate variable phi=I{p>lambda}, and use a modification of logistic regression to fit phi~f(z). The "kernel" method examines the density of z where p>lambda and computes Pr(p>lambda) from that.

Binning simply computes the Storey pi0 estimate with the given lambda within each bin.

Value

an "fPi0" object, which contains the following components:

table

a tibble with one row for each hypothesis, and columns p.value, z, z0, and fpi0

tableLambda

An expanded version of the table that shows the estimation results for each choice of lambda

MISE

The estimated mean integrated squared error (MISE) of the estimated pi0(z) for each choice of lambda

lambda

The chosen value of lambda

Examples

1
2
sim.ttests = simulate_t_tests(m = 1000)
fpi0 <- estimate_fpi0(p = sim.ttests$p.value, z0 = sim.ttests$n, method = "kernel")

StoreyLab/fFDR documentation built on March 8, 2021, 10:14 p.m.