lmeNBBayes
.
Reduce
=1 in the computation of lmeNBBayes
) is a target distribution, the DIC is computed using the focused likelihood $ Pr(Y[i]=y[i]| { a[G[h]] }[h=1]^{M}, { r[G_h] }[h=1]^{M}, { H[h] }[h=1]^{M}, beta) $.
If not, then the DIC is computed using the focused likelihood $ Pr(Y[i] |a[G[h[i]]],r[G[h[i]]], ,beta) $.
getDIC(olmeNBB, data, ID, useSample=NULL,focus = c("FG","G","aGh.rGh","para"), lower.alpha=0.0001,upper.alpha=0.99999,inc.alpha=0.0005)
llk.FG_i(ys,rs,aGs,bGs,ps)
lmeNBBayes
.
lmeNBBayes
.
lmeNBBayes
.
Y
), containing TRUE or FALSE, indicating
which samples to be kept or discarded.
focus
is FG
. See details.
focus
is FG
. See details.
focus
is FG
. See details.
bGs
.
aGs
.
Denote $P$ be a vector of "focused" parameters.
Using Spiegelhalter et. al.(2002)'s notation, the effective number of parmeters can be computed as:
$p[D]=D.bar - D( P.bar)$
where $D$ is the deviance and the $P.bar$ is the expectation of $P$.
When focus
= FG
then the focused parameters, denoted as $P$, are the random effect distribution
(i.e.,infinite mixture of beta distribution) and the regression coefficients. In the computation, the expected regression coefficients are obtained by simply computing the mean of the posterior samples of coefficients. The expected infinite mixture of beta distribution is obtained in the following steps:
STEP 1: Provide a fine grids of points between [0,1]. We chose the grid of points to be
alphas <- seq(lower.alpha,upper.alpha,inc.alpha)
.
STEP 2: For each sampled infinite mixture of betas,
Evaluate its value at every grid provided from STEP 1 for each sample.
Obtain B
by length(alphas)
matrix.
STEP 3: Given the matrix from STEP2, at each grid of points, we compute the average value of density.
Obtain a vector of length length(alpha)
, that contains the estimated expected random effect density at fine grid of points.
STEP 4: Given the estimated expected coefficients and the estimated expected random effect density, evaluate $D(P.bar)$ by integrating the conditional likelihood given random effects with respect to the estimated expected random effect density from STEP 3.
Spiegelhalter, D.J.; Best, N. G.; Carlin, B.P., van der Linde, A. (2002). "Bayesian measures of model complexity and fit (with discussion)". Journal of the Royal Statistical Society, Series B 64 (4): 583-639.
lmeNBBayes
## See the examples of function lmeNBBayes
Run the code above in your browser using DataLab