Title: | Clinical Trial Calculation Based on BCHM Design |
---|---|
Description: | Users can estimate the treatment effect for multiple subgroups basket trials based on the Bayesian Cluster Hierarchical Model (BCHM). In this model, a Bayesian non-parametric method is applied to dynamically calculate the number of clusters by conducting the multiple cluster classification based on subgroup outcomes. Hierarchical model is used to compute the posterior probability of treatment effect with the borrowing strength determined by the Bayesian non-parametric clustering and the similarities between subgroups. To use this package, 'JAGS' software and 'rjags' package are required, and users need to pre-install them. |
Authors: | Nan Chen and J. Jack Lee |
Maintainer: | J. Jack Lee <[email protected]> |
License: | LGPL-2 |
Version: | 1.00 |
Built: | 2024-10-31 06:28:14 UTC |
Source: | CRAN |
The BCHM computation is based on the Bayesian Cluster Hierarchical Model (BCHM) to perform the non-parametric Bayesian clustering and posterior probability calculation with the Bayesian hierarchical model for binary response data in several subgroups. Due to the potential heterogeneity among subgroups, the exchangeability assumption across all subgroups may not hold. A Bayesian non-parametric method is applied to calculate the number of clusters by conducting the multiple cluster classification based on subgroup outcomes. Due to the MCMC sampling, the clustering result is dynamic. A cluster matrix (Similarity Matrix) is constructed to depict the strength of association between any two subgroups to be classified into the same cluster. The Bayesian hierarchical model is used to compute the posterior probability of treatment effect with the borrowing strength determined by the similarity matrix values calculated from the Bayesian non-parametric clustering.
BCHM( nDat, xDat, mu = 0.2, sigma02 = 10, sigmaD2 = 0.001, alpha = 1e-60, d0 = 0.05, alpha1 = 50, beta1 = 10, tau2 = 0.1, phi1 = 0.1, deltaT = 0.05, thetaT = 0.6, burnIn = 10000, MCIter = 20000, MCNum = 20000, seed = 1000 )
BCHM( nDat, xDat, mu = 0.2, sigma02 = 10, sigmaD2 = 0.001, alpha = 1e-60, d0 = 0.05, alpha1 = 50, beta1 = 10, tau2 = 0.1, phi1 = 0.1, deltaT = 0.05, thetaT = 0.6, burnIn = 10000, MCIter = 20000, MCNum = 20000, seed = 1000 )
nDat |
Number of patients in each subgroup. |
xDat |
Number of responses in each subgroup. |
mu |
Hyperprior mean for the cluster. |
sigma02 |
Hyperprior variance for the cluster. |
sigmaD2 |
Variance of subgroup response rate. |
alpha |
Alpha value of the Dirichlet Process determining number of clusters. |
d0 |
Minimum value for the similarity matrix. |
alpha1 |
Prior for borrowing strength gamma(alpha1, beta1) in the hierarchical model. |
beta1 |
Prior for borrowing strength gamma(alpha1, beta1) in the hierarchical model. |
tau2 |
Hyperprior precision parameter of subgroup means in the hierarchical model |
phi1 |
The response rate of the standard treatment. |
deltaT |
The expected improvement in the response rate over the standard treatment. |
thetaT |
Threshold value for the inference claiming efficacy. |
burnIn |
Number of burn_in in MCMC. |
MCIter |
Number of MCMC iterations. |
MCNum |
Number of MCMC iterations in the hierarchical model. |
seed |
Random seed. |
The return is a list including three elements: Samples
, SMatrix
, and Result
.
The return list element Samples
is the sampled posterior response rates of all subgroups.
The return list element SMatrix
is the similarity matrix of all subgroups.
The return list element Result
is the calculation results of all subgroups. It has seven columns: the number of responses of each subgroups, the number of patients in each subgroups, the observe response rates of each subgroups, the cluster index of each subgroups, the posterior mean response rates of each subgroups, the probability of Pr(P>Phi1+deltaT) of each subgroups, and the final decision (0: Not rejected the null, 1 Rejected the null). Note: Because a MCMC computation is applied in the clustering calculation, there are many possible clustering configurations. The cluster index in column 4 is the most possible clustering configuration.
BCHMplot_cluster Plot the clustering results of subgroups.
BCHMplot_post_value Plot the posterior response of subgroups.
BCHMplot_post_dist Plot the posterior distributions of subgroups.
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_cluster(res, col, pch=16) BCHMplot_post_value(res, col, HPD = 0.8) BCHMplot_post_dist(res, col, lty=1:length(nDat), lwd =3, xlim=c(0, 0.8))
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_cluster(res, col, pch=16) BCHMplot_post_value(res, col, HPD = 0.8) BCHMplot_post_dist(res, col, lty=1:length(nDat), lwd =3, xlim=c(0, 0.8))
plot the observed response rate versus subgroup ID with clusters coded by the color of dots.
BCHMplot_cluster( res, col = res$Result[, 4], pch = 16, xlim = c(0, dim(res$Result)[1] + 2), ylim = c(0, 1), cex = 2, ... )
BCHMplot_cluster( res, col = res$Result[, 4], pch = 16, xlim = c(0, dim(res$Result)[1] + 2), ylim = c(0, 1), cex = 2, ... )
res |
BCHM calculation results. |
col |
Color vector |
pch |
pch vector |
xlim |
X-axis range |
ylim |
Y-axis range |
cex |
size of points |
... |
other options |
None
BCHM Perform the analysis based on the BCHM design.
BCHMplot_post_value Plot the posterior response of subgroups.
BCHMplot_post_dist Plot the posterior distributions of subgroups.
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_cluster(res, col, pch=16)
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_cluster(res, col, pch=16)
plot the posterior distribution by subgroup ID
BCHMplot_post_dist( res, col = res$Result[, 4], lty = 1:dim(res$Result)[1], lwd = 2, xlim = c(0, 1), ylim = c(0, 20), ... )
BCHMplot_post_dist( res, col = res$Result[, 4], lty = 1:dim(res$Result)[1], lwd = 2, xlim = c(0, 1), ylim = c(0, 20), ... )
res |
BCHM calculation results. |
col |
Color vector |
lty |
line types |
lwd |
line width |
xlim |
X-axis range |
ylim |
Y-axis range |
... |
other options |
None
BCHM Perform the analysis based on the BCHM design.
BCHMplot_cluster Plot the clustering results of subgroups.
BCHMplot_post_value Plot the posterior response of subgroups.
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_post_dist(res, col, lty=1:length(nDat), lwd =3, xlim=c(0, 0.8))
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_post_dist(res, col, lty=1:length(nDat), lwd =3, xlim=c(0, 0.8))
plot the posterior response rate with its highest probability density (HPD) interval by subgroup ID
BCHMplot_post_value( res, col = res$Result[, 4], pch = c(19, 4), cex = 2, HPD = 0.95, xlim = c(0, dim(res$Result)[1] + 2), ylim = c(0, 1), ObsMean = FALSE, ... )
BCHMplot_post_value( res, col = res$Result[, 4], pch = c(19, 4), cex = 2, HPD = 0.95, xlim = c(0, dim(res$Result)[1] + 2), ylim = c(0, 1), ObsMean = FALSE, ... )
res |
BCHM calculation results. |
col |
Color vector |
pch |
pch vector pch[1] Posterior mean pch[2] Observed mean |
cex |
size of points |
HPD |
Highest Posterior Density level for drawing (NA: No HPD drawing ) |
xlim |
X-axis range |
ylim |
Y-axis range |
ObsMean |
Draw the observed mean of subgroups if this parameter is TRUE |
... |
other options |
None
BCHM Perform the analysis based on the BCHM design.
BCHMplot_cluster Plot the clustering results of subgroups.
BCHMplot_post_dist Plot the posterior distributions of subgroups.
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_post_value(res, col, HPD = 0.8)
nDat = c(25, 25, 25, 25) # total number of patients xDat = c(2, 3, 8, 6) # number of responses alpha <- 1e-20 d0 <- 0.0 alpha1 = 50 beta1 = 10 tau2 <- 0.1 phi1 <- 0.1 deltaT <- 0.2 thetaT <- 0.60 res <- BCHM(nDat = nDat, xDat = xDat, alpha = alpha, d0 = d0, alpha1 = alpha1, beta1 = beta1, tau2 = tau2, phi1 = phi1, deltaT = deltaT, thetaT = thetaT, burnIn = 100, MCIter = 200, MCNum = 1000, seed = 1000 ) print(res$SMatrix) print(res$Result) col <- res$Result[,4] BCHMplot_post_value(res, col, HPD = 0.8)