The R BCHM package provides a computation tool for the designs and analyses based on Bayesian Cluster Hierarchical Model (BCHM).In this study, a Bayesian non-parametric method is applied to dynamically calculate the number of clusters and conduct the multiple cluster classification based on subgroup outcomes. Borrowing strength is determined by the similarity computed from the Bayesian non-parametric clustering method:

Here is an example of the usage of the BCHM package:

library(BCHM)
#> Loading required package: rjags
#> Loading required package: coda
#> Linked to JAGS 4.3.0
#> Loaded modules: basemod,bugs

# Trial example
nDat = c(15, 3, 12, 28, 29, 29, 26, 5, 2, 20) # total number of patients
xDat = c(2, 0, 1, 6, 7, 3, 5, 1, 0, 3)  # number of responses
alpha <- 1e-20 
d0 <- 0.05 


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 = 2000,
            MCNum = 4000,
            seed = 1000
)
print(res$SMatrix)
#>       1    2    3    4    5    6    7    8    9   10
#> 1  1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
#> 2  1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
#> 3  1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
#> 4  0.05 0.05 0.05 1.00 1.00 0.05 1.00 1.00 0.05 0.05
#> 5  0.05 0.05 0.05 1.00 1.00 0.05 1.00 1.00 0.05 0.05
#> 6  1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
#> 7  0.05 0.05 0.05 1.00 1.00 0.05 1.00 1.00 0.05 0.05
#> 8  0.05 0.05 0.05 1.00 1.00 0.05 1.00 1.00 0.05 0.05
#> 9  1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
#> 10 1.00 1.00 1.00 0.05 0.05 1.00 0.05 0.05 1.00 1.00
print(res$Result)
#>          Resp. No.Pat Obs. Rate Cluster Post. Mean Prob(P>Phi1+deltaT)
#> Subg. 1      2     15     0.133       1      0.122               0.004
#> Subg. 2      0      3     0.000       1      0.115               0.007
#> Subg. 3      1     12     0.083       1      0.119               0.003
#> Subg. 4      6     28     0.214       2      0.200               0.056
#> Subg. 5      7     29     0.241       2      0.213               0.089
#> Subg. 6      3     29     0.103       1      0.115               0.001
#> Subg. 7      5     26     0.192       2      0.190               0.040
#> Subg. 8      1      5     0.200       2      0.192               0.094
#> Subg. 9      0      2     0.000       1      0.118               0.011
#> Subg. 10     3     20     0.150       1      0.129               0.004
#>          Decision
#> Subg. 1         0
#> Subg. 2         0
#> Subg. 3         0
#> Subg. 4         0
#> Subg. 5         0
#> Subg. 6         0
#> Subg. 7         0
#> Subg. 8         0
#> Subg. 9         0
#> Subg. 10        0
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))