lm_pi0 {swfdr}R Documentation

Estimate pi0(x)

Description

Estimate pi0(x)

Usage

lm_pi0(pValues, lambda = seq(0.05, 0.95, 0.05), X, type = "logistic",
  smooth.df = 3, threshold = TRUE)

Arguments

pValues

Numerical vector of p-values

lambda

Numerical vector of thresholds. Must be in [0,1).

X

Design matrix (one test per row, one variable per column). Do not include the intercept.

type

Type of regression, "logistic" or "linear." Default is logistic.

smooth.df

Number of degrees of freedom when estimating pi0(x) with a smoother.

threshold

If TRUE (default), all estimates are thresholded at 0 and 1, if FALSE, none of them are.

Value

pi0 Numerical vector of smoothed estimate of pi0(x). The length is the number of rows in X.

pi0.lambda Numerical matrix of estimated pi0(x) for each value of lambda. The number of columns is the number of tests, the number of rows is the length of lambda.

lambda Vector of the values of lambda used in calculating pi0.lambda

pi0.smooth Matrix of fitted values from the smoother fit to the pi0(x) estimates at each value of lambda (same number of rows and columns as pi0.lambda)

Examples

X <- seq(-1,2,length=1000) ##covariate
pi0 <- 1/4*X + 1/2 ##probability of being null
nullI <- rbinom(1000,prob=pi0,size=1)> 0 ##generate null/alternative p-values
pValues <- rep(NA,1000) ##vector of p-values
pValues[nullI] <- runif(sum(nullI)) ##null from U(0,1)
pValues[!nullI] <- rbeta(sum(!nullI),1,2) ##alternative from Beta
pi0x <- lm_pi0(pValues=pValues, X=X, smooth.df=3)


[Package swfdr version 1.6.0 Index]