Plot an FDR regression model.

Share:

Description

Plots the results of a fitted FDR regression model from FDRreg.

Usage

1
plotFDR(fdrr, Q=0.1, showrug=TRUE, showfz=TRUE, showsub=TRUE) 

Arguments

fdrr

A fitted model object from FDRreg.

Q

The desired level at which FDR should be controlled. Defaults to 0.1, or 10 percent.

showrug

Logical flag indicating whether the findings at the specified FDR level should be displayed in a rug plot beneath the histogram. Defaults to TRUE.

showfz

Logical flag indicating the fitted marginal density f(z) should be plotted. Defaults to TRUE.

showsub

Logical flag indicating whether a subtitle should be displayed describing features of the plot. Defaults to TRUE.

Details

It is important to remember that localfdr (and therefore global FDR) is not necessarily monotonic in z, because the regression model allows the prior probability that z[i] is a signal to change with covariates x[i].

Value

No return value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(FDRreg)

# Simulated data
P = 2
N = 10000
betatrue = c(-3.5,rep(1/sqrt(P), P))
X = matrix(rnorm(N*P), N,P)
psi = crossprod(t(cbind(1,X)), betatrue)
wsuccess = 1/{1+exp(-psi)}

# Some theta's are signals, most are noise
gammatrue = rbinom(N,1,wsuccess)
table(gammatrue)

# Density of signals
thetatrue = rnorm(N,3,0.5)
thetatrue[gammatrue==0] = 0
z = rnorm(N, thetatrue, 1)
hist(z, 100, prob=TRUE, col='lightblue', border=NA)
curve(dnorm(x,0,1), add=TRUE, n=1001)

## Not run: 
# Fit the model
fdr1 <- FDRreg(z, covars=X, nmc=2500, nburn=100, nmids=120, nulltype='theoretical')
# Show the empirical-Bayes estimate of the mixture density
# and the findings at a specific FDR level
Q = 0.1
plotFDR(fdr1, Q=Q, showfz=TRUE)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.