filter_EM: Adaptive knockoff filter based on Bayeian two group model

Description Usage Arguments Value See Also Examples

View source: R/filter_EM.R

Description

filter_EM takes the inmportance statistic W as input. The filter determines the order of the statistic by the Bayesian posterior probability of being a null.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
filter_EM(
  W,
  U,
  alpha = 0.1,
  offset = 1,
  mute = TRUE,
  df = 3,
  R = 1,
  s0 = 0.005,
  cutoff = NULL
)

Arguments

W

vector of length p, denoting the imporatence statistics calculated by knockoff.filter.

U

p-by-r matrix of side information.

alpha

target FDR level (default is 0.1).

mute

whether \hat{fdp} of each iteration is printed (defalt is TRUE).

df

Degree of freedom of the splines (default is 3).

R

Number of iterations in the EM algorithm

reveal_prop

The proportion of hypotheses revealed at intialization (default is 0.4).

Value

A list of the following:

nrejs

The number of rejections for each specified target fdr (alpha) level

rejs

Rejsction set fot each specified target fdr (alpha) level

rej.path

The order of the hypotheses (used for diagnostics)

unrevealed.id

id of the hypotheses that are nor revealed in the end (used for diagnostics)

tau

Threshold of each target FDR level (used for diagnostics)

acc

The accuracy of classfication at each step (used for diagnostics)

See Also

Other filter: filter_gam(), filter_glmnet(), filter_glm(), filter_randomForest_getorder(), filter_randomForest()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#Generating data
p=100;n=100;k=40;
mu = rep(0,p); Sigma = diag(p)
X = matrix(rnorm(n*p),n)
nonzero = 1:k
beta = 5*(1:p%in%nonzero)*sign(rnorm(p))/ sqrt(n)
y = X%*%beta + rnorm(n,1)

#Generate knockoff copy
Xk = create.gaussian(X,mu,Sigma)

#Generate importance statistic using knockoff package
W = stat.glmnet_coefdiff(X,Xk,y)

#Using filer_EM to obtain the final rejeciton set
U = 1:p #Use the location of the hypotheses as the side information
result = filter_EM(W,U)

zhimeir/adaptiveKnockoffs documentation built on Oct. 6, 2021, 9:41 p.m.