density_PLS: Penalized least-squares method

Description Usage Arguments Value Examples

View source: R/density_PLS.R

Description

The semiparametric model is employed to estimate the log density derivatives of the chi-squared statistics.

Usage

1
density_PLS(x, qq)

Arguments

x

a sequence of chi-squared test statistics

qq

the quantiles used for splines

Value

a list: the first and second density derivatives

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
p = 1000
k = 7
# the prior distribution for lambda
alpha = 2
beta =  10
# lambda
lambda = rep(0, p)
pi_0 = 0.5
p_0 = floor(p*pi_0)
p_1 = p-p_0
lambda[(p_0+1):p] = stats::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 = c(0.2, 0.4, 0.6, 0.8)
out = density_PLS(X, qq)

EBCHS documentation built on June 1, 2021, 9:08 a.m.