fpi0est: Estimate the functional proportion of null tests

View source: R/fpi0est.R

fpi0estR Documentation

Estimate the functional proportion of null tests

Description

he function fpi0est estimates the functional proportion of null tests given a set of informative variables.

Usage

fpi0est(
  p,
  z,
  pi0_model,
  indep_snps = NULL,
  lambda = seq(0.05, 0.9, 0.05),
  method = "gam",
  maxit = 1000,
  pi0.method.control = NULL,
  ...
)

Arguments

p

A vector of p-values.

z

A vector of informative variables

pi0_model

Model formula corresponding to z for the functional proportion of truly null tests.

indep_snps

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

lambda

A vector of values between [0,1] to estimate the functional proportion of truly null tests.

method

Either the "gam" (generalized additive model) or "glm" (generalized linear models) approach. Default is "gam".

maxit

The maximum number of iterations for "glm" approach. Default is 1000.

pi0.method.control

A user specified set of parameters for convergence for either "gam" or "glm". Default is NULL. See gam.control or glm.control.

...

Additional arguments passed to gam or glm.

Details

This code extends the function from the fFDR package to handle multiple informative variables and linkage disequilibrium.

Value

A list of object type "fpi0" containing:

fpi0

A table containing the functional proportion of truly null tests.

tableLambda

Functional proportion of null tests at the lambda values

MISE

MISE values.

lambda.hat

The chosen lambda value.

Author(s)

Andrew J. Bass, David G. Robinson (author of original function)

See Also

sffdr, 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

# See relationship of BFP/cholesterol/triglycerides and fpi0
plot(fmod$zt$bfp, fpi0)
plot(fmod$zt$cholesterol, fpi0)
plot(fmod$zt$triglycerides, fpi0)


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