## Not run:
#
# ## generate samples from DSMSB review 2
# d <- getS.StatInMed(rev=2,iseed=1,dist="YZ",Scenario="full")
# formula.fit <- Y ~ timeInt1:trtAss + timeInt2:trtAss
#
# B <- 10000
# burnin <- 1000
# thin <- 2
# fit <- lmeNBBayes(formula=formula.fit,data=d, ID=d$ID,
# B = B, burnin = burnin, thin=thin)
# ## The output can be printed out:
# fit
#
#
# ## Now, compute the conditional probability index using the mean function of placebo patients.
# ## We need to modify two things in output of lmeNBBayes.
# ## 1st, change the formula so that it does not distinguish between treatment and placebo
# fit$para$formula <- Y ~ timeInt1 + timeInt2
# ## 2nd, disregard the coefficient that corresponds to the treated patients
# fit$beta <- fit$beta[,-c(3,5)]
# cpi <- index.batch.Bayes(data=d,labelnp=d$labelnp,ID=d$ID,
# olmeNBB=fit,printFreq=10^7)
# cpi
#
# ## finally access the accuracy of the CPI estimates in terms of RMSE
# Npat <- length(unique(d$ID))
# est <- cpi$condProbSummary[,1]
# true <- d$probIndex[1:Npat]
# sqrt( mean( ( est - true )^2 ,na.rm=TRUE) )
#
#
# ## End(Not run)
Run the code above in your browser using DataLab