lmeNB (version 1.2)

CP.se: Compute a conditional probability of observing a set of counts as extreme as the new observations of a subject given the previous observations from the same subject based on the negative binomial mixed effect independent model.

Description

Given the parameter estimates of c( alpha,theta,beta0,beta1,...) of the negative binomial mixed effect independent model, these functions compute the following conditional probability:

Pr(q(Y_new) >= q(y_new) | Y_pre = y_pre)

where y_new and y_pre are vectors of previous and new observations from a same subject and q() is a function which provides a scalar summary of the new observations. These functions are subroutines of index.batch.When input the maximum likelihood estimates of the paramters, CP.se returns the estimate of the conditional probability of single subject and the asymptotic standard error of the logit of the estimate of the conditional probability based on the independent model. The computation for of the probability is done by its subroutine jCP.

Usage

CP.se(tpar, Y1, Y2, sn1, sn2, XM = NULL, dist = "G", V, pty = "sum")
jCP(tpar, Y1, Y2, sn1, sn2, XM = NULL, dist = "G", LG = FALSE, oth = NULL, type = "sum")

Arguments

tpar
A vector of length 3 + # covariates, containing the estimates of the model in the order of log(a),log(theta),beta0,beta1... If random effects are assumed to be from the log-normal distribution, then theta is a variance estimate o
Y1
A scalar containing the sum of the previously observed response counts of a subject.
Y2
A scalar containing the summary statistics of the newly observed response counts of a subject q(y_new)
sn1
The number of previous observations.
sn2
The number of new observations.
XM
A n_i by # covariates matrix containing the covariate values of subject i, where whre n_i is the total number of previous and new observations. If there is no covariate, i.e., the model only has an intercept term, then set
dist
If dist=="G", then the conditional probability is computed by assuming the random effect is from the gamma distribution. If dist=="N", then the conditional probability is computed by assuming the random effect is from the log-nor
V
The variance covariance matrix of the parameter estimates.
pty
The summary statistics for the new scans. q(). The current options are "sum" and "max".
oth
The argument only for jCP.

If dist= "G" or "N", oth=NULL. If dist="NoN", othr must be the frequency table of the random effects. i.e.,dist=obj$gtb where obj<

LG
If LG=TRUE then the logit of the conditional probability is returned.
type
Same as pty.

References

Zhao, Y., Li, D.K.B., Petkau, J.A., Riddehough, A. & Traboulsee, A. Detection of unusual increases in MRI lesion counts in multiple sclerosis patients.

See Also

The functions to fit the relevant models:

mle.fun, mle.ar1.fun, mle.a3.fun, mle.ar1.non3,

The other subroutines of index.batch to compute the conditional probability index:MCCP.ar1, CP.ar1.se, CP.se, jCP,

The functions to generate simulated datasets: rNBME.R.

Examples

Run this code
## tpar contains: log(a),log(theta),beta0
tpar <-  c(0.5, -0.5, 1.3)
## A scalar containing the sum of the response counts in pre scans
Y1 <- 0
## A scalar containing the summary statistics of the response counts in new scans q(y_new)
Y2 <- 1
## The number of scans in the pre scans.
sn1 <- 2
## The number of scans in the new scans.
sn2 <- 3
## the covariate matrix
XM <- NULL
dist <- "G"
## the variance covariance matrix:
V <- matrix(
  c(0.0490673003, -0.0004481864, 0.013279476,
   -0.0004481864,  0.0245814022, 0.001231522,
    0.0132794760,  0.0012315221, 0.023888065),nrow=3)

## the estimate of the conditional probability based on the sum summary statistics and its SE
CP.se(tpar = tpar, Y1=Y1 ,Y2= Y2, sn1 = sn1, sn2 = sn2, XM = XM, dist = dist, V = V, pty = "sum")

## the estimate of the conditional probability based on the max summary statistics and its SE
CP.se(tpar = tpar, Y1=Y1 ,Y2= Y2, sn1 = sn1, sn2 = sn2, XM = XM, dist = dist, V = V, pty = "max")

## jCP calls for CP.se to compute the estimate of the conditional probability
jCP(tpar = tpar, Y1 = Y1, Y2 = Y2, sn1 = sn1, sn2 = sn2, 
    XM = XM, dist = dist, LG = FALSE, oth = NULL, type = "sum")

Run the code above in your browser using DataLab