EB_CS: Main function used in the paper (Du and Hu, 2020+)

Description Usage Arguments Value Examples

View source: R/core.R View source: R/EB_CS.R

Description

Main function used in the paper (Du and Hu, 2020+)

Usage

1
2
3
4
5
6
7
EB_CS(
  x,
  df,
  qq = c(0.2, 0.4, 0.6, 0.8),
  method = c("LS", "PLS", "g_model"),
  mixture = FALSE
)

Arguments

x

a sequence of chi-squared test statistics

df

the degrees of freedom

qq

the quantiles used in spline basis

method

LS: parametric least-squares; PLS: penalized least-squares; g-model: g-modeling

mixture

FALSE: there is no a point mass at zero

Value

a list: posterior mean, variance, and skewness estimates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
set.seed(2020)
p = 1000
k = 7
# the prior distribution for lambda
alpha = 2
beta =  10
# lambda
lambda = rep(0, p)
pi_0 = 0
p_0 = floor(p*pi_0)
p_1 = p-p_0
lambda[(p_0+1):p] = rgamma(p_1, shape = alpha, rate=1/beta)
# Generate a Poisson RV
J = sapply(1:p, function(x){rpois(1, lambda[x]/2)})
X = sapply(1:p, function(x){rchisq(1, k+2*J[x])})
qq_set = seq(0.01, 0.99, 0.01)
out = EB_CS(X, k, qq=qq_set, method='LS', mixture = FALSE)
E = out$E_lambda
V = out$V_lambda
UP = E+1.645*V^(1/2)
LOW = E-1.645*V^(1/2)

dulilun/EB documentation built on May 30, 2021, 2:18 a.m.