density_LS {EBCHS} | R Documentation |
log-density derivatives–parametric approach
Description
Assuming the log density of the chi-squared statistics admits a parametric form, this function estimates up to the fourth order log density derivatives.
Usage
density_LS(x)
Arguments
x |
a sequence of chi-squared test statistics |
Value
a list: the first-to-fourth log density derivatives
Examples
p = 1000
k = 7
# the prior distribution for lambda
alpha = 2
beta = 10
# lambda
lambda = rep(0, p)
pi_0 = 0.8
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])})
out = density_LS(X)
[Package EBCHS version 0.1.0 Index]