# index_batch_Bayes: The main function to compute the point estimates and 95%... In lmeNBBayes: Compute the Personalized Activity Index Based on a Flexible Bayesian Negative Binomial Model

## Description

Let m[i] be the number of pre-measurements and n[i] be the total number of repeated measures. Then the repeated measure of a subject can be divided into a pre-measurement set and a new measurement set as Y[i]=(Y[i,pre],Y[i,new]) , where Y[i,pre]=(y[i,1],\cdots,Y[i,m[i]]) and Y[i,new]=(Y[i,m[i]+1],...,Y[i,n[i]]) . Given an output of `lmeNBBayes`, this function computes the probability of observing the response counts as large as those new observations of subject i, y[i,new] conditional on the subject's previous observations y[i,pre] for subject i. That is, this function returns a point estimate and its asymptotic 95% confidence interval (for a parametric model) of the conditional probability for each subject:

Pr( Y[i,new+] ≥ y[i,new] | Y[i,pre]=y[i,pre]) , where Y[i,new+]=∑[j=m[i]+1]^{n[i]} Y[ij] .

## Usage

 `1` ```index.batch.Bayes(data,labelnp,ID,olmeNBB,thin=NULL,printFreq=10^5,unExpIncrease=TRUE) ```

## Arguments

 `data` See `lmeNBBayes`. This `data` does not have to be the same as the one used in the computations of negative binomial mixed effect regression (`lmeNBBayes`). `labelnp` See `lmeNBBayes`. `nrow(data)` == `length(labelnp)` must be satisfied. `ID` See the description in `lmeNBBayes`. `nrow(data)` == `length(labelnp)` must be satisfied. `olmeNBB` The output of the function `lmeNBBayes`. `thin` The frequency of thinning `printFreq` See the description in `lmeNBBayes`. `unExpIncrease` Internal use only. Should be always TRUE.

## Value

 `condProb` `(olmeNBB\$para\$B-olmeNBB\$para\$burnin)/thin` by the number of patients, N (=`length(unique(ID))`), matrix, containing the MCMC samples of the conditional probability index for each patient at every selected iteration (after discarding burn-in and thinning). If some patients have 0 pre-scans or 0 new-scans, then `NA` is returned. `condProbSummary` `4` by N matrix. The first column contains the posterior estimates of the conditional probability index. The second column contains the posterior SE. The third column contains the lower bound of the 95% credible interval. The fourth column contains the upper bound of the 95% credible interval.

Kondo, Y.

## References

Kondo, Y., Zhao, Y. and Petkau, A.J., "A flexible mixed effect negative binomial regression model for detecting unusual increases in MRI lesion counts in individual multiple sclerosis patients".

`lmeNBBayes` `getDIC` `dqmix`
 `1` ```## See the examples of function lmeNBBayes ```