This is the function that actually runs the JAGS MCMC machinery to produce
posterior samples from all model parameters and required derived values.
It is a generic function, so that customized versions may be conveniently
defined for specific subclasses of GeneralData, GeneralModel, and
McmcOptions input.
Usage
mcmc(data, model, options, ...)
# S4 method for class 'GeneralData,GeneralModel,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'GeneralData,DualEndpointRW,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'GeneralData,DualEndpointBeta,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'GeneralData,DualEndpointEmax,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'GeneralData,OneParLogNormalPrior,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'GeneralData,OneParExpPrior,McmcOptions'
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)
# S4 method for class 'DataMixture,GeneralModel,McmcOptions'
mcmc(
data,
model,
options,
from_prior = data@nObs == 0L & data@nObsshare == 0L,
...
)
# S4 method for class 'Data,LogisticIndepBeta,McmcOptions'
mcmc(data, model, options, ...)
# S4 method for class 'DataDual,Effloglog,McmcOptions'
mcmc(data, model, options, ...)
# S4 method for class 'DataDual,EffFlexi,McmcOptions'
mcmc(data, model, options, ...)
# S4 method for class 'DataOrdinal,LogisticLogNormalOrdinal,McmcOptions'
mcmc(data, model, options, ...)Value
The posterior samples, an object of class Samples.
Functions
mcmc(data = GeneralData, model = GeneralModel, options = McmcOptions): Standard method which uses JAGS.mcmc(data = GeneralData, model = DualEndpointRW, options = McmcOptions): Standard method which uses JAGS. For theDualEndpointRWmodel, it is required that there are at least two (in case of random walk prior of the first order on the biomarker level) or three doses in the grid.mcmc(data = GeneralData, model = DualEndpointBeta, options = McmcOptions): Standard method which uses JAGS. For theDualEndpointBetamodel, it is required that the value ofref_dose_betaslot is greater than the maximum dose in a grid. This requirement comes from definition of the beta function that is used to model dose-biomarker relationship inDualEndpointBetamodel. The other requirement is that there must be at least one dose in the grid.mcmc(data = GeneralData, model = DualEndpointEmax, options = McmcOptions): Standard method which uses JAGS. For theDualEndpointEmaxmodel, it is required that there is at least one dose in the grid.mcmc(data = GeneralData, model = OneParLogNormalPrior, options = McmcOptions): Standard method which uses JAGS. For theOneParLogNormalPriormodel, it is required that the length of skeleton prior probabilities vector should be equal to the length of the number of doses.mcmc(data = GeneralData, model = OneParExpPrior, options = McmcOptions): Standard method which uses JAGS. For theOneParExpPriormodel, it is required that the length of skeleton prior probabilities vector should be equal to the length of the number of doses.mcmc(data = DataMixture, model = GeneralModel, options = McmcOptions): Method forDataMixturewith differentfrom_priordefault. Samples from the prior only when both the number of observations and the number of shared observations are zero.mcmc(data = Data, model = LogisticIndepBeta, options = McmcOptions): Obtain posterior samples for the model parameters based on the pseudoLogisticIndepBetaDLE model. The joint prior and posterior probability density function of the intercept \(\phi_1\) (phi1) and the slope \(\phi_2\) (phi2) are given in Whitehead and Williamson (1998) . However, since asymptotically, the joint posterior probability density will be bivariate normal, we use the bivariate normal distribution to generate posterior samples of the intercept and the slope parameters. For the prior samples of the intercept and the slope, a bivariate normal distribution with mean and the covariance matrix given in Whitehead and Williamson (1998) is used.mcmc(data = DataDual, model = Effloglog, options = McmcOptions): Obtain the posterior samples for the model parameters in theEffloglogmodel. Given the value of \(\nu\), the precision of the efficacy responses, the joint prior or the posterior probability of the intercept \(\theta_1\) (theta1) and the slope \(\theta_2\) (theta2) is a bivariate normal distribution. The \(\nu\) (nu), the precision of the efficacy responses is either a fixed value or has a gamma distribution. If a gamma distribution is used, the samples ofnuwill be first generated. Then the mean of thenusamples will be used to generate samples of the intercept and slope parameters of the model.mcmc(data = DataDual, model = EffFlexi, options = McmcOptions): Obtain the posterior samples for the estimates in theEffFleximodel. This is the MCMC procedure based on what is described in Lang and Brezger (2004) such that samples of the mean efficacy responses at all dose levels, samples ofsigma2\(\sigma^2\), the variance of the efficacy response and samples ofsigma2betaW\(\sigma^2_{\beta_W}\), the variance of the random walk model will be generated. Please refer to Lang and Brezger (2004) for the procedures and the form of the joint prior and posterior probability density for the mean efficacy responses. In addition, bothsigma2andsigma2betaWcan be fixed or have an inverse-gamma prior and posterior distribution. Therefore, if the inverse gamma distribution(s) are used, the parameters in the distribution will be first updated and then samples ofsigma2andsigma2betaWwill be generated using the updated parameters.-
mcmc( data = DataOrdinal, model = LogisticLogNormalOrdinal, options = McmcOptions ): Obtain the posterior samples for the model parameters in theLogisticLogNormalOrdinalmodel.The generic
mcmcmethod returns aSamplesobject with elements of thedataslot namedalpha[1],alpha[2], ...,alpha[k]andbetawhen passed aLogisticLogNormalOrdinalobject. This makes the "alpha elements" awkward to access and is inconsistent with other model objects. So rename the alpha elements toalpha1,alpha2, ...,alpha<k>for ease and consistency.
Note
The type of Random Number Generator (RNG) and its initial seed used by
JAGS are taken from the options argument. If no initial values are
supplied (i.e RNG kind or seed slot in options has NA), then they will
be generated automatically by JAGS.
References
Lang S, Brezger A (2004).
“Bayesian P-Splines.”
Journal of Computational and Graphical Statistics, 13(1), 183–212.
ISSN 10618600, doi:10.1198/1061860043010
, http://www.jstor.org/stable/1391151.
Whitehead J, Williamson D (1998).
“Bayesian decision procedures based on logistic regression models for dose-finding studies.”
Journal of Biopharmaceutical Statistics, 8(3), 445–467.
Examples
# Create some data from the class `Data`.
my_data <- Data(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y = c(0, 0, 0, 0, 0, 0, 1, 0),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
#> Used default patient IDs!
#> Used best guess cohort indices!
# Initialize the CRM model.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 100,
step = 2,
samples = 1000
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
#> An object of class "Samples"
#> Slot "data":
#> $alpha0
#> [1] 0.2146137194 0.5641709649 0.4818539903 0.3912945687 -0.0306697660
#> [6] -0.0306697660 -0.0306697660 -0.0306697660 -0.0306697660 -0.0306697660
#> [11] -0.0306697660 -0.0306697660 -0.0306697660 -0.0306697660 -0.0306697660
#> [16] -1.0092835089 0.0872897895 0.0872897895 0.2022708214 0.2022708214
#> [21] 0.2022708214 0.2022708214 -0.2811631840 -0.2811631840 -0.2811631840
#> [26] -0.3163592358 -0.3163592358 0.3306268681 0.3306268681 0.7731348632
#> [31] -0.3479323736 -0.2075230971 -0.2075230971 0.3455161984 -0.4677730209
#> [36] -0.3163736643 -0.3163736643 -1.3515212281 -0.3418772999 -0.3418772999
#> [41] 0.4216978896 0.4216978896 -0.2526326398 -0.2424669208 -0.2331634874
#> [46] 0.1544018428 0.1544018428 1.7986981835 1.7986981835 1.7986981835
#> [51] -0.5328081148 -0.5328081148 0.7880439079 0.0696619759 -0.7532964765
#> [56] 0.9881753161 0.9881753161 0.9881753161 0.9881753161 1.0747947629
#> [61] -0.3163164077 -0.3163164077 -0.3163164077 -0.7054306897 -0.7054306897
#> [66] -0.7054306897 -0.7054306897 -0.7054306897 0.7861196856 0.7861196856
#> [71] 0.7861196856 0.7861196856 0.7861196856 -0.2702113053 -0.2702113053
#> [76] -0.1776371669 -1.1591806628 -2.7666082188 -2.7666082188 -2.4190011055
#> [81] -1.7817078355 -0.8789953637 -0.8789953637 -0.8789953637 -0.8789953637
#> [86] -0.8789953637 -0.8789953637 -0.2710047783 0.6001781233 0.6001781233
#> [91] 1.0839606932 0.9900205510 1.3771287464 1.3771287464 0.8246009791
#> [96] 0.8246009791 0.8246009791 -1.2248898501 -1.1397850604 -1.6279317049
#> [101] -1.4269067849 -0.7685479802 -0.7542226094 -1.3503371000 0.5798702472
#> [106] 0.2078657553 0.2802902284 0.2802902284 0.2802902284 0.2802902284
#> [111] 0.2802902284 -0.7344739379 -0.7344739379 -1.0204563669 -1.0204563669
#> [116] -1.0613515493 -0.5786276681 -0.5076073943 -0.5076073943 0.0881084347
#> [121] 0.0881084347 1.0073804243 -0.1107103179 0.4314383855 0.1826464685
#> [126] 0.1826464685 0.1826464685 0.1826464685 0.1826464685 0.1826464685
#> [131] 0.1826464685 0.1826464685 0.1826464685 0.1826464685 0.1826464685
#> [136] 0.1826464685 0.1826464685 0.1826464685 0.1826464685 0.1826464685
#> [141] -0.0101200211 -0.0101200211 -0.4637738132 -0.4637738132 -0.4637738132
#> [146] -0.5199819106 -0.3258101678 0.4634754226 0.4634754226 0.1002312737
#> [151] 0.3617821978 0.0523851959 -0.3795321880 -0.1362918791 -0.1362918791
#> [156] -0.1362918791 -0.9929090050 -0.9929090050 -0.9929090050 -0.9929090050
#> [161] -0.9929090050 0.9116305546 0.1858971740 0.1858971740 0.1858971740
#> [166] 0.1858971740 0.1858971740 0.1858971740 0.1858971740 0.1858971740
#> [171] -0.3424271914 -0.3424271914 -0.6411713898 -0.8999648639 -0.7070076944
#> [176] -0.7070076944 -0.7070076944 -0.7070076944 -0.7070076944 -0.7070076944
#> [181] -0.6609104011 -0.7715482633 0.2361875813 0.2361875813 0.2361875813
#> [186] 0.2361875813 0.2361875813 -0.0564067814 -0.0564067814 0.0616176739
#> [191] -0.5410058994 -1.1143190874 -0.7870430556 -0.7870430556 -0.3613534699
#> [196] -0.3613534699 0.4309791059 0.3255798295 0.3255798295 -1.1109151898
#> [201] -1.1109151898 -1.1109151898 -0.9066347337 -0.9066347337 -0.9066347337
#> [206] -0.3694286814 -0.9791360630 -0.3690284426 -0.3690284426 0.0836330392
#> [211] 0.0836330392 0.0836330392 0.0836330392 0.0836330392 0.0836330392
#> [216] -0.8674555738 -0.8674555738 -0.8674555738 0.1325461018 0.3709730159
#> [221] 0.3709730159 0.3709730159 0.6781599136 0.6781599136 -0.2460525253
#> [226] -0.2460525253 -0.6733229346 -1.1202995052 -0.2971349207 -0.2971349207
#> [231] -0.9378456972 -0.9378456972 -0.3623149795 -0.7823550510 -0.7823550510
#> [236] -0.1195963026 -0.1195963026 -1.0160424818 -0.7709722507 -0.7709722507
#> [241] -0.7709722507 0.5742097789 -1.2126781018 -0.1016027488 -0.1016027488
#> [246] -0.1016027488 -0.1016027488 -0.9733100606 -0.9733100606 -0.9733100606
#> [251] 0.0532808427 0.8862808530 0.8862808530 0.8862808530 0.8862808530
#> [256] 0.6650047325 0.6650047325 -0.1650803189 -1.3228710168 -1.3228710168
#> [261] -1.3228710168 -0.8687402586 -0.8687402586 0.1033395397 0.1033395397
#> [266] -1.1547369971 -1.6406592316 -1.6406592316 0.2808124450 0.9577903825
#> [271] -0.6928717488 -0.3901905273 -0.7636534943 -0.7636534943 -0.7636534943
#> [276] -1.1333724005 0.4432103570 0.4432103570 -0.5226280619 0.0487959173
#> [281] 0.0487959173 0.3067535546 0.8490141180 0.8490141180 0.8490141180
#> [286] 0.8490141180 0.8490141180 -1.6724550473 0.3141923378 -0.3423183811
#> [291] -0.3423183811 -0.3423183811 -1.1692262118 -1.1692262118 -0.4130582943
#> [296] -0.4130582943 -0.4130582943 -0.4130582943 -0.4130582943 -0.4130582943
#> [301] -0.9881966865 -0.1258313592 -0.1258313592 -0.1258313592 -0.1258313592
#> [306] -0.2789272529 0.2722363382 0.2722363382 -0.5459472282 0.3957264536
#> [311] 0.5926532445 0.5926532445 0.5926532445 0.5926532445 0.5926532445
#> [316] -0.3048165860 -0.3048165860 -0.4260804656 -0.4260804656 -0.4260804656
#> [321] -0.4260804656 -0.4260804656 -0.4260804656 -0.4260804656 -0.4260804656
#> [326] -0.4260804656 -0.2812084233 -0.2812084233 -0.2812084233 -0.2812084233
#> [331] -1.3688621317 -1.3688621317 -1.6562281055 0.1202203953 -1.5581579127
#> [336] -1.1416902068 0.5795499564 0.5795499564 0.5795499564 0.5795499564
#> [341] -0.1102680183 -1.2453391145 -0.7586422223 -0.7586422223 -0.7586422223
#> [346] -0.4374653473 -0.3495303837 -0.3495303837 -1.6671045744 -0.7467077885
#> [351] 0.5870435334 0.5870435334 0.8632814081 0.0578423482 0.0578423482
#> [356] 0.9328985002 0.9328985002 1.1611751749 1.1611751749 1.1611751749
#> [361] 1.1611751749 1.1611751749 1.1611751749 -0.0472393511 -0.0472393511
#> [366] -1.0195027644 -1.1194120896 -1.1603060606 -1.1603060606 -1.1603060606
#> [371] -1.0324769461 -1.0324769461 -1.0324769461 -1.0324769461 -1.0324769461
#> [376] -1.0324769461 -1.0324769461 -1.0324769461 -1.8055530146 -1.6037403997
#> [381] -1.6037403997 0.2930380428 1.0474717602 1.0474717602 -0.2999318530
#> [386] 0.7467557315 0.7467557315 0.7467557315 0.7467557315 -0.3558085858
#> [391] -0.3558085858 -0.0483136988 -0.0483136988 -0.2843321152 0.3669744469
#> [396] -1.0767069693 -1.0767069693 -0.7451539794 -0.7451539794 0.5651844229
#> [401] 0.5651844229 0.0208204506 -0.9668948287 -1.0961931934 -1.0961931934
#> [406] 0.1463285953 0.1463285953 0.1463285953 0.1463285953 0.3821338680
#> [411] 0.6660103101 0.6660103101 0.6660103101 0.6660103101 -1.3054873498
#> [416] 0.0480047267 0.0480047267 -0.8059579462 -0.3152571307 -0.3152571307
#> [421] -0.6180524911 0.6928510323 0.6928510323 -0.4675743673 -0.4675743673
#> [426] -0.4675743673 0.5981851487 0.5981851487 0.5981851487 0.0977548635
#> [431] 0.0977548635 0.0977548635 0.0977548635 0.0977548635 -1.4359282678
#> [436] -1.4359282678 -1.1294410476 -0.7430939679 0.9198412950 2.4486512111
#> [441] 2.7355080097 2.2333815704 2.2333815704 0.8874341385 0.8874341385
#> [446] 0.4053636220 -0.1624647767 -0.4829885781 0.2856902842 0.2856902842
#> [451] 0.2856902842 0.2856902842 0.2856902842 -1.0158540835 0.9066364771
#> [456] -0.6368646059 -0.6368646059 -1.2560306440 -1.0114930128 -1.0114930128
#> [461] -1.0114930128 -0.2821027910 -0.3048112619 -0.3048112619 -0.3048112619
#> [466] -0.3048112619 -0.0905193051 -0.0905193051 -0.2139490886 -0.5747337964
#> [471] -0.5747337964 -0.7996945364 -0.7996945364 -0.7996945364 -0.7996945364
#> [476] -0.0327731784 0.6935701663 0.6935701663 -0.5806734717 -0.5806734717
#> [481] -0.2324043901 -0.4463206024 -0.4463206024 -0.4463206024 -0.0387949595
#> [486] -0.4182617817 -1.5272535865 -1.5272535865 -1.2255926689 -1.2255926689
#> [491] -1.2255926689 0.3595227091 0.3595227091 0.3595227091 -0.2913608824
#> [496] -0.2913608824 -0.2913608824 -0.8389930841 -1.0377327825 -0.8506168431
#> [501] -0.8506168431 -0.4512172121 -0.4512172121 0.0763151932 0.2837787656
#> [506] 0.2837787656 0.4163271815 -1.0282867373 -1.0282867373 -1.0282867373
#> [511] -1.0282867373 -1.0282867373 -0.1805163978 -0.1805163978 -0.7455103565
#> [516] 0.0350332355 0.0350332355 0.0350332355 0.0350332355 0.0350332355
#> [521] -0.3493400296 -0.2031954842 -0.2031954842 -0.2031954842 -0.2031954842
#> [526] 1.1076690272 1.1076690272 1.1076690272 0.4798779418 -1.7579677850
#> [531] -0.4776231497 -1.9074784968 -1.9074784968 -1.9074784968 -1.9074784968
#> [536] -0.1760599582 -1.5548615556 -1.5548615556 -0.2803463498 0.9375506094
#> [541] -1.1439088615 -1.1439088615 -0.6174323305 -0.6174323305 -0.6174323305
#> [546] -0.0006858672 -0.0006858672 -0.4259403975 -0.0188445547 -0.0188445547
#> [551] -0.0188445547 -0.0188445547 -0.0188445547 -0.0188445547 -0.0188445547
#> [556] -0.9740044347 -0.9740044347 -1.1106488862 -0.6118556165 0.6211457462
#> [561] 0.6211457462 -0.1218857261 -0.1218857261 -0.4205813263 -0.4205813263
#> [566] -0.4411151585 -0.0475622799 -0.0475622799 -0.0475622799 -1.1493430383
#> [571] -1.5733261546 -0.5559868803 -0.5559868803 -0.4013711143 -0.3997437830
#> [576] -1.0508295749 -0.1984555924 -0.1984555924 -0.1984555924 -0.1984555924
#> [581] -0.9548520675 -0.2218089623 -0.2218089623 0.2336518452 0.5410724903
#> [586] 0.5410724903 -0.0576472045 -0.0576472045 -0.0576472045 -0.6807398576
#> [591] -0.6807398576 -0.6807398576 -0.6807398576 -0.6807398576 -0.6807398576
#> [596] -0.6807398576 -0.1863931067 -0.1863931067 -0.0894258583 -0.0729288883
#> [601] -0.7543072369 -1.5290966521 -1.5290966521 -1.5290966521 -1.5290966521
#> [606] -1.5290966521 -1.5290966521 -0.1360537427 -0.1391483750 -0.1391483750
#> [611] 0.5132343976 0.5132343976 -2.3288786771 -1.2964994418 -0.3526903778
#> [616] -0.3526903778 -0.3526903778 -0.2862445207 -0.2862445207 -0.2862445207
#> [621] -0.0485116497 -1.5281045855 -0.5400749949 -0.5400749949 -0.5400749949
#> [626] -0.9573374188 -0.8175437947 -0.8175437947 -0.8175437947 -0.4150805762
#> [631] 0.5783542633 -0.1388471554 0.7492830188 0.4543992343 0.4543992343
#> [636] 0.4543992343 0.4543992343 0.4543992343 0.4543992343 0.4543992343
#> [641] 0.4543992343 -0.8098279233 -0.8098279233 -0.8098279233 -0.6452766860
#> [646] -0.6452766860 -0.9035413124 -0.9035413124 -1.2563771052 -1.2563771052
#> [651] -1.2563771052 -1.2563771052 -0.3002180510 -0.3002180510 -0.3002180510
#> [656] -0.3002180510 -0.3002180510 -0.3002180510 1.1870834081 0.7330452757
#> [661] 0.7330452757 0.7330452757 0.7330452757 0.5311955264 0.0983520232
#> [666] -1.1344183631 -0.6103113984 0.2976260525 0.2976260525 -0.1635683233
#> [671] 0.9644337745 0.9644337745 0.9644337745 0.7030923353 0.1487417342
#> [676] 0.1487417342 0.1487417342 0.1487417342 0.1487417342 -1.8582279466
#> [681] -2.4519433530 -2.4519433530 -2.4519433530 -0.6186701467 -0.6186701467
#> [686] -0.6186701467 -0.6186701467 -0.9942878482 -0.9942878482 1.2348155638
#> [691] -1.0992431715 -1.0992431715 1.2300084308 0.0914008865 -0.7500495420
#> [696] -0.5669322021 -0.6085435326 -0.6085435326 -0.2759456307 0.2980581175
#> [701] 0.2980581175 -0.8695049081 -0.8695049081 0.3239144168 0.3239144168
#> [706] -0.7319979246 -0.7319979246 -0.7319979246 -0.7319979246 -0.7319979246
#> [711] -0.7319979246 -0.3914132055 -0.3914132055 -0.3914132055 -0.3914132055
#> [716] 0.1776805781 0.8539875435 -1.4976181393 -1.1927772812 -1.2917218424
#> [721] -0.6060195688 -0.6060195688 -0.6060195688 -0.6060195688 -0.6060195688
#> [726] -0.6060195688 -0.6060195688 -0.6060195688 -0.6060195688 -0.6060195688
#> [731] -0.1694378271 -0.4388595427 -0.4388595427 -0.4249764157 -0.1182061837
#> [736] -0.3884552188 -0.0915158967 -0.0915158967 0.1947202326 0.0315312538
#> [741] 0.0315312538 0.6252144173 0.6252144173 -0.9200681078 -0.9200681078
#> [746] 0.1627889272 0.1627889272 0.1627889272 0.1518367244 -0.3437791010
#> [751] -0.3437791010 0.2998901046 0.2998901046 0.2998901046 0.2998901046
#> [756] 0.9724746822 -0.5562256711 -1.5382718137 0.0624964181 0.0624964181
#> [761] 0.0624964181 0.5556620415 -0.4200390483 -0.4869447726 -1.0026072376
#> [766] 0.5591977103 0.5591977103 0.5591977103 0.5591977103 -1.5802095525
#> [771] -1.5802095525 -1.5802095525 -1.5802095525 0.0280113989 -0.4738918585
#> [776] 0.4978641334 0.4978641334 0.2730775232 -1.1947850721 -0.3681450509
#> [781] -0.3681450509 -0.3681450509 -0.3681450509 -0.3681450509 -0.3681450509
#> [786] -0.3681450509 -0.3681450509 -0.9831666362 -0.6783382828 -0.6783382828
#> [791] 0.0732206288 0.0732206288 0.0732206288 -0.4194535697 0.4870247237
#> [796] 0.4870247237 0.4870247237 0.0214814557 0.0214814557 0.0214814557
#> [801] 0.0214814557 0.0214814557 0.2855559284 0.2855559284 0.0603441133
#> [806] -0.2816368243 -0.2816368243 -0.2816368243 -0.2816368243 0.0237012885
#> [811] 0.0237012885 0.0237012885 0.0237012885 0.0237012885 0.0237012885
#> [816] 0.0237012885 0.0237012885 -0.0061017695 -0.0061017695 -0.4004593978
#> [821] -0.4004593978 -0.4004593978 -1.1208403001 -0.7630812709 -0.3884627059
#> [826] -1.0805304141 -1.6863582505 -1.9848360865 -0.8637991577 0.5896268935
#> [831] -0.0691212988 -0.0691212988 -0.0691212988 -0.0691212988 -0.3642881602
#> [836] -0.3642881602 -0.3642881602 0.7784712425 0.7784712425 0.7784712425
#> [841] 1.0350900849 1.0350900849 1.4386952966 1.4386952966 0.2733610412
#> [846] 0.2733610412 0.2733610412 1.0818875604 1.0818875604 1.0818875604
#> [851] 0.0011672336 0.8814680603 0.8814680603 0.8814680603 0.8814680603
#> [856] 0.8814680603 1.4293500580 1.4293500580 1.2520431185 1.2520431185
#> [861] 1.2520431185 1.2520431185 0.9494184517 0.9494184517 0.9494184517
#> [866] 0.9494184517 0.5566779386 -0.7384691938 -0.7384691938 -0.7384691938
#> [871] -0.7384691938 -0.7384691938 -0.0170782705 -0.0170782705 -0.0170782705
#> [876] -0.0170782705 0.5134001226 -0.1629108768 -0.0879544067 -0.0879544067
#> [881] -0.0879544067 -1.2845558516 -1.2845558516 -0.1194147323 -0.9722768137
#> [886] -2.4052811919 -2.4052811919 -2.4052811919 -2.4052811919 -1.8569499110
#> [891] -1.8569499110 -1.8569499110 -1.6756056111 0.4948971433 0.0547686316
#> [896] 0.0547686316 -0.4190235737 -0.4190235737 -0.4190235737 0.3571765094
#> [901] -0.2189210712 -0.2189210712 -0.3649406067 -0.3649406067 -0.3649406067
#> [906] -0.4905298102 -0.4905298102 -0.4905298102 -0.4905298102 -1.1886510914
#> [911] -0.3391210302 0.2106773584 0.2106773584 0.2106773584 0.2106773584
#> [916] 0.2106773584 0.2106773584 0.2106773584 0.2106773584 0.2106773584
#> [921] 0.2607268490 0.2607268490 0.2607268490 0.2284954402 0.2284954402
#> [926] 0.0999814815 0.0999814815 0.0999814815 -0.7724631456 -1.2279123144
#> [931] -0.1509063398 -0.1509063398 -0.1509063398 -0.1509063398 -0.1509063398
#> [936] -0.1509063398 1.3936598873 0.7402102395 0.8827216029 0.1349566138
#> [941] 0.1874138187 0.5824580201 0.5265610116 0.2920542382 0.2920542382
#> [946] 0.2920542382 0.6433337653 0.1292167109 0.1292167109 0.1292167109
#> [951] 0.1292167109 0.1292167109 0.1292167109 0.1292167109 0.1292167109
#> [956] -0.1132910064 -0.1132910064 0.3738520921 0.8641456882 0.9502789819
#> [961] 0.4890632704 0.4890632704 1.7220590307 0.4272935520 0.4272935520
#> [966] 0.4272935520 1.0131265395 1.0131265395 1.0131265395 1.0131265395
#> [971] -0.5256024351 -0.5256024351 -0.5256024351 -0.6770706073 1.7763048256
#> [976] 1.7763048256 1.7763048256 1.7763048256 1.7763048256 1.6214259582
#> [981] 0.2048697975 -0.1983142407 -1.1036062160 -1.1036062160 0.9185167277
#> [986] 1.0027050892 0.4250002844 0.3082561796 -0.2231625393 -0.3938908776
#> [991] -0.3938908776 -0.3938908776 -0.4486677037 -0.4486677037 -0.4486677037
#> [996] -0.9061803696 -1.1218020122 -0.4045378968 -0.4731628077 -0.4731628077
#>
#> $alpha1
#> [1] 0.7917370 1.3081796 1.8700738 2.2629889 1.0603075 1.0603075 1.0603075
#> [8] 1.0603075 1.0603075 1.0603075 1.0603075 1.0603075 1.0603075 1.0603075
#> [15] 1.0603075 0.9092468 0.7042758 0.7042758 1.2821558 1.2821558 1.2821558
#> [22] 1.2821558 1.0427419 1.0427419 1.0427419 0.8564041 0.8564041 0.7169524
#> [29] 0.7169524 0.7068324 1.4056682 1.7933619 1.7933619 2.1072136 1.3725475
#> [36] 0.8590197 0.8590197 2.1362703 0.6019876 0.6019876 1.3456013 1.3456013
#> [43] 1.5682910 0.4217366 1.4091765 1.7966497 1.7966497 1.4595362 1.4595362
#> [50] 1.4595362 1.5086013 1.5086013 1.0134039 0.7174090 2.4207553 1.9329665
#> [57] 1.9329665 1.9329665 1.9329665 0.8057158 0.4801131 0.4801131 0.4801131
#> [64] 1.1252325 1.1252325 1.1252325 1.1252325 1.1252325 1.6175307 1.6175307
#> [71] 1.6175307 1.6175307 1.6175307 1.0751559 1.0751559 0.9364013 0.9317383
#> [78] 2.2440411 2.2440411 0.6644731 0.3416742 1.7453802 1.7453802 1.7453802
#> [85] 1.7453802 1.7453802 1.7453802 2.1323869 1.5110510 1.5110510 1.9735252
#> [92] 2.3780249 1.1523030 1.1523030 2.2109901 2.2109901 2.2109901 0.5724305
#> [99] 1.6215348 1.1088059 0.7970970 0.3504582 0.2527002 0.5503024 1.6373974
#> [106] 1.1177552 2.3217306 2.3217306 2.3217306 2.3217306 2.3217306 0.7215103
#> [113] 0.7215103 0.5469097 0.5469097 2.5221547 3.1905088 3.1598828 3.1598828
#> [120] 2.2863468 2.2863468 0.5096785 2.4694812 1.5340882 0.8371244 0.8371244
#> [127] 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244
#> [134] 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244 0.8371244
#> [141] 0.3957184 0.3957184 0.7297807 0.7297807 0.7297807 1.3064895 2.3655250
#> [148] 0.8538152 0.8538152 0.6397475 2.8673269 2.3502403 0.7693938 1.6893793
#> [155] 1.6893793 1.6893793 1.4053339 1.4053339 1.4053339 1.4053339 1.4053339
#> [162] 1.6101004 1.1686329 1.1686329 1.1686329 1.1686329 1.1686329 1.1686329
#> [169] 1.1686329 1.1686329 0.8582283 0.8582283 0.4348127 0.6643353 0.6981720
#> [176] 0.6981720 0.6981720 0.6981720 0.6981720 0.6981720 1.3585972 1.7329122
#> [183] 0.6283079 0.6283079 0.6283079 0.6283079 0.6283079 1.3540461 1.3540461
#> [190] 1.2047300 0.8547890 0.7434898 0.7954897 0.7954897 3.1488391 3.1488391
#> [197] 0.8112995 2.0942846 2.0942846 1.5057162 1.5057162 1.5057162 1.1665682
#> [204] 1.1665682 1.1665682 0.5503670 0.5933174 0.4187552 0.4187552 0.6129956
#> [211] 0.6129956 0.6129956 0.6129956 0.6129956 0.6129956 0.8926438 0.8926438
#> [218] 0.8926438 0.8924553 0.8588538 0.8588538 0.8588538 1.6817060 1.6817060
#> [225] 0.9064099 0.9064099 0.4605067 1.7382179 1.7328072 1.7328072 1.0479762
#> [232] 1.0479762 1.4082146 0.8218050 0.8218050 1.6890302 1.6890302 1.0072999
#> [239] 0.8496470 0.8496470 0.8496470 0.8670851 1.4252686 2.2953603 2.2953603
#> [246] 2.2953603 2.2953603 2.7452447 2.7452447 2.7452447 0.7621714 1.2700437
#> [253] 1.2700437 1.2700437 1.2700437 0.8856638 0.8856638 1.5360469 1.8889431
#> [260] 1.8889431 1.8889431 1.1142559 1.1142559 1.2024449 1.2024449 1.2218213
#> [267] 0.7127015 0.7127015 1.5567126 0.6308563 0.4034499 1.8206965 0.8092738
#> [274] 0.8092738 0.8092738 1.1829173 0.8775566 0.8775566 1.2349516 1.0529202
#> [281] 1.0529202 0.7508879 1.3899782 1.3899782 1.3899782 1.3899782 1.3899782
#> [288] 0.6699275 1.0633400 0.9882691 0.9882691 0.9882691 0.4720295 0.4720295
#> [295] 0.6130445 0.6130445 0.6130445 0.6130445 0.6130445 0.6130445 1.3915400
#> [302] 0.9091571 0.9091571 0.9091571 0.9091571 1.3829745 1.7896191 1.7896191
#> [309] 1.3539768 2.2083248 1.1848685 1.1848685 1.1848685 1.1848685 1.1848685
#> [316] 1.1654431 1.1654431 1.3402896 1.3402896 1.3402896 1.3402896 1.3402896
#> [323] 1.3402896 1.3402896 1.3402896 1.3402896 0.8578705 0.8578705 0.8578705
#> [330] 0.8578705 0.7161156 0.7161156 0.7169569 1.1154214 0.9089188 0.8370759
#> [337] 1.6769943 1.6769943 1.6769943 1.6769943 1.3822819 2.4432223 0.8877496
#> [344] 0.8877496 0.8877496 1.6837720 2.6285439 2.6285439 1.6378742 0.4025769
#> [351] 0.8414077 0.8414077 0.7340144 0.7374387 0.7374387 0.7328623 0.7328623
#> [358] 0.9151760 0.9151760 0.9151760 0.9151760 0.9151760 0.9151760 1.6360613
#> [365] 1.6360613 1.0426266 0.5678214 0.7324657 0.7324657 0.7324657 0.4753527
#> [372] 0.4753527 0.4753527 0.4753527 0.4753527 0.4753527 0.4753527 0.4753527
#> [379] 1.7153283 0.7755501 0.7755501 2.5941941 0.9775365 0.9775365 0.8897648
#> [386] 1.3422599 1.3422599 1.3422599 1.3422599 0.9078850 0.9078850 1.1915558
#> [393] 1.1915558 0.8051819 1.6879568 0.4137200 0.4137200 0.3679876 0.3679876
#> [400] 0.6998754 0.6998754 1.4709266 0.6988683 0.9863704 0.9863704 0.8780636
#> [407] 0.8780636 0.8780636 0.8780636 2.2597602 0.6041600 0.6041600 0.6041600
#> [414] 0.6041600 0.6712208 0.3725056 0.3725056 0.7624801 1.5508774 1.5508774
#> [421] 0.9848378 1.1488232 1.1488232 1.1904602 1.1904602 1.1904602 1.7595534
#> [428] 1.7595534 1.7595534 1.2001486 1.2001486 1.2001486 1.2001486 1.2001486
#> [435] 1.2820748 1.2820748 2.6478631 1.8894095 1.0059703 1.5803134 1.5915169
#> [442] 0.8419530 0.8419530 1.4213281 1.4213281 1.5430139 0.6324109 0.5586435
#> [449] 0.8818160 0.8818160 0.8818160 0.8818160 0.8818160 0.9556114 1.7172816
#> [456] 0.5228968 0.5228968 0.9718453 0.5272229 0.5272229 0.5272229 1.2837812
#> [463] 1.0298084 1.0298084 1.0298084 1.0298084 1.8587172 1.8587172 1.0715737
#> [470] 0.6303084 0.6303084 0.7416461 0.7416461 0.7416461 0.7416461 1.3611752
#> [477] 1.8720751 1.8720751 0.6808959 0.6808959 0.4824145 1.3785982 1.3785982
#> [484] 1.3785982 0.7981682 1.2071996 0.8382779 0.8382779 1.5509793 1.5509793
#> [491] 1.5509793 1.1645364 1.1645364 1.1645364 1.3767368 1.3767368 1.3767368
#> [498] 0.8548725 1.2712691 1.4574509 1.4574509 1.9051429 1.9051429 1.3409290
#> [505] 1.3635237 1.3635237 1.2410002 1.2814515 1.2814515 1.2814515 1.2814515
#> [512] 1.2814515 1.6523971 1.6523971 1.1412484 1.2578492 1.2578492 1.2578492
#> [519] 1.2578492 1.2578492 0.8928350 0.9397763 0.9397763 0.9397763 0.9397763
#> [526] 1.6233959 1.6233959 1.6233959 0.7171390 0.9913364 0.6462822 2.1123253
#> [533] 2.1123253 2.1123253 2.1123253 0.3751013 0.9667254 0.9667254 2.2994752
#> [540] 2.2138323 1.3320258 1.3320258 0.9472529 0.9472529 0.9472529 1.7554899
#> [547] 1.7554899 2.0718874 1.3937062 1.3937062 1.3937062 1.3937062 1.3937062
#> [554] 1.3937062 1.3937062 0.7007914 0.7007914 1.6359817 1.5716042 1.4103419
#> [561] 1.4103419 0.6695676 0.6695676 0.4402370 0.4402370 0.7234301 0.5456575
#> [568] 0.5456575 0.5456575 0.8728091 1.6931721 1.5416692 1.5416692 0.9278219
#> [575] 1.4009635 1.7986029 0.5555654 0.5555654 0.5555654 0.5555654 0.9361639
#> [582] 0.6944183 0.6944183 0.8817470 0.5443138 0.5443138 0.5304679 0.5304679
#> [589] 0.5304679 1.2904568 1.2904568 1.2904568 1.2904568 1.2904568 1.2904568
#> [596] 1.2904568 1.7172143 1.7172143 0.9735363 1.4896246 1.5160079 1.2596569
#> [603] 1.2596569 1.2596569 1.2596569 1.2596569 1.2596569 1.4470306 1.3502610
#> [610] 1.3502610 0.9654018 0.9654018 1.6884172 0.3914262 1.1995580 1.1995580
#> [617] 1.1995580 1.4712215 1.4712215 1.4712215 2.6031366 2.5143462 2.1907330
#> [624] 2.1907330 2.1907330 1.5088912 0.6920042 0.6920042 0.6920042 1.1470690
#> [631] 1.5831596 1.7956900 0.9988838 1.3209724 1.3209724 1.3209724 1.3209724
#> [638] 1.3209724 1.3209724 1.3209724 1.3209724 1.6452479 1.6452479 1.6452479
#> [645] 1.2119069 1.2119069 0.4936953 0.4936953 0.3587535 0.3587535 0.3587535
#> [652] 0.3587535 2.0316072 2.0316072 2.0316072 2.0316072 2.0316072 2.0316072
#> [659] 0.9493770 1.3259545 1.3259545 1.3259545 1.3259545 1.2226947 0.6549682
#> [666] 0.4336281 0.4072077 1.2862200 1.2862200 0.4415037 1.5778730 1.5778730
#> [673] 1.5778730 0.8831034 1.1403116 1.1403116 1.1403116 1.1403116 1.1403116
#> [680] 0.4363686 0.8405281 0.8405281 0.8405281 2.7296045 2.7296045 2.7296045
#> [687] 2.7296045 1.6012799 1.6012799 0.8112227 0.7878407 0.7878407 0.8811961
#> [694] 1.0753725 0.4527138 0.8627492 2.1549582 2.1549582 1.2385689 0.6560492
#> [701] 0.6560492 0.9408191 0.9408191 0.6787561 0.6787561 1.2202080 1.2202080
#> [708] 1.2202080 1.2202080 1.2202080 1.2202080 1.1014846 1.1014846 1.1014846
#> [715] 1.1014846 0.6557434 1.0601915 0.5959966 0.3759863 0.3361061 1.4255795
#> [722] 1.4255795 1.4255795 1.4255795 1.4255795 1.4255795 1.4255795 1.4255795
#> [729] 1.4255795 1.4255795 1.8253473 0.4927518 0.4927518 1.2470205 0.7415499
#> [736] 2.1798378 0.7944330 0.7944330 0.7345389 0.8262787 0.8262787 0.4258637
#> [743] 0.4258637 0.4498573 0.4498573 1.0222056 1.0222056 1.0222056 1.6522832
#> [750] 0.6990536 0.6990536 1.1670938 1.1670938 1.1670938 1.1670938 1.6254313
#> [757] 0.4510178 2.3440121 0.6289021 0.6289021 0.6289021 0.3782421 0.3768690
#> [764] 2.2784216 0.6650136 0.9373335 0.9373335 0.9373335 0.9373335 0.6572333
#> [771] 0.6572333 0.6572333 0.6572333 0.4787605 1.5429217 0.6423942 0.6423942
#> [778] 0.6389663 1.7261039 0.9152364 0.9152364 0.9152364 0.9152364 0.9152364
#> [785] 0.9152364 0.9152364 0.9152364 0.6277698 0.4182170 0.4182170 1.9283933
#> [792] 1.9283933 1.9283933 0.7141828 0.9851319 0.9851319 0.9851319 1.8029570
#> [799] 1.8029570 1.8029570 1.8029570 1.8029570 0.6535443 0.6535443 0.7551002
#> [806] 0.8812345 0.8812345 0.8812345 0.8812345 0.5686085 0.5686085 0.5686085
#> [813] 0.5686085 0.5686085 0.5686085 0.5686085 0.5686085 0.9567553 0.9567553
#> [820] 2.3266345 2.3266345 2.3266345 0.7838823 1.6897666 0.6180077 1.0548160
#> [827] 1.8541514 1.0076032 1.4229894 0.4354447 0.8731756 0.8731756 0.8731756
#> [834] 0.8731756 0.6552498 0.6552498 0.6552498 1.0298514 1.0298514 1.0298514
#> [841] 0.7681159 0.7681159 1.6079934 1.6079934 0.4945243 0.4945243 0.4945243
#> [848] 1.4066167 1.4066167 1.4066167 0.5852994 0.7586521 0.7586521 0.7586521
#> [855] 0.7586521 0.7586521 1.2201353 1.2201353 1.7838093 1.7838093 1.7838093
#> [862] 1.7838093 1.0071854 1.0071854 1.0071854 1.0071854 1.5997722 0.9954544
#> [869] 0.9954544 0.9954544 0.9954544 0.9954544 0.9393592 0.9393592 0.9393592
#> [876] 0.9393592 0.7447739 0.5195344 0.9920574 0.9920574 0.9920574 0.9369837
#> [883] 0.9369837 2.1144204 1.4551243 0.8485772 0.8485772 0.8485772 0.8485772
#> [890] 1.0991005 1.0991005 1.0991005 0.5873147 0.4836161 0.7477504 0.7477504
#> [897] 0.6880737 0.6880737 0.6880737 1.4583015 1.6004334 1.6004334 0.9875864
#> [904] 0.9875864 0.9875864 0.8873316 0.8873316 0.8873316 0.8873316 1.7761541
#> [911] 0.5016117 0.9660523 0.9660523 0.9660523 0.9660523 0.9660523 0.9660523
#> [918] 0.9660523 0.9660523 0.9660523 0.9680514 0.9680514 0.9680514 0.8179167
#> [925] 0.8179167 1.4438292 1.4438292 1.4438292 0.8349265 0.9747586 0.3904063
#> [932] 0.3904063 0.3904063 0.3904063 0.3904063 0.3904063 1.0488293 1.6345392
#> [939] 3.0482815 1.3554051 1.0161460 1.2030994 0.3199647 0.6882634 0.6882634
#> [946] 0.6882634 1.3326410 1.3541625 1.3541625 1.3541625 1.3541625 1.3541625
#> [953] 1.3541625 1.3541625 1.3541625 0.8041347 0.8041347 0.5005653 0.3132680
#> [960] 0.8666747 0.8287874 0.8287874 1.0647324 1.3163029 1.3163029 1.3163029
#> [967] 2.0824682 2.0824682 2.0824682 2.0824682 4.0500731 4.0500731 4.0500731
#> [974] 2.8868700 1.8111157 1.8111157 1.8111157 1.8111157 1.8111157 0.8471020
#> [981] 1.5041017 1.7200229 1.6627900 1.6627900 0.9277503 0.4732787 0.5708874
#> [988] 0.9216535 1.0822384 1.4033630 1.4033630 1.4033630 1.6208574 1.6208574
#> [995] 1.6208574 1.2169354 1.4991606 0.6383522 0.2030676 0.2030676
#>
#>
#> Slot "options":
#> An object of class "McmcOptions"
#> Slot "iterations":
#> [1] 2100
#>
#> Slot "burnin":
#> [1] 100
#>
#> Slot "step":
#> [1] 2
#>
#> Slot "rng_kind":
#> [1] NA
#>
#> Slot "rng_seed":
#> [1] NA
#>
#>
# Create some data from the class `DataDual`.
plcb <- 0.001
my_data <- DataDual(
w = c(13, 77, 86, 26, 27, 36, 37, 97, 21, 49, 87, 48),
x = c(plcb, 25, 25, 25, plcb, 50, 50, 50, plcb, 100, 100, 100),
y = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L),
doseGrid = c(plcb, seq(25, 300, 25)),
placebo = TRUE,
ID = 1:12,
cohort = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L)
)
# Initialize the CRM model.
my_model <- DualEndpointRW(
mean = c(0, 1),
cov = matrix(c(1, 0, 0, 1), nrow = 2),
sigma2W = c(a = 0.1, b = 0.1),
rho = c(a = 1, b = 1),
sigma2betaW = 0.01,
rw1 = TRUE
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 50,
step = 2,
samples = 4,
rng_kind = "Mersenne-Twister",
rng_seed = 1
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
#> An object of class "Samples"
#> Slot "data":
#> $betaW
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,] 43.97979 44.41466 44.43972 44.11392 44.62213 45.16043 45.16812 45.21349
#> [2,] 43.15657 42.91989 43.51310 44.68803 44.56862 44.87953 44.94821 45.51928
#> [3,] 63.68104 63.29789 63.85898 64.05148 63.52357 64.10696 64.75609 65.32082
#> [4,] 50.45590 49.98192 49.94248 50.23495 50.54648 50.68016 51.02047 50.21193
#> [,9] [,10] [,11] [,12] [,13]
#> [1,] 45.17819 44.50411 44.97736 44.98087 45.22721
#> [2,] 45.87216 45.26223 45.42696 45.75288 45.95267
#> [3,] 65.62907 65.52253 66.59065 66.42558 66.77227
#> [4,] 50.02701 49.17010 49.01135 49.45278 49.73688
#>
#> $betaZ
#> [,1] [,2]
#> [1,] -2.507907 0.03496807
#> [2,] -2.507907 0.03496807
#> [3,] -2.507907 0.03496807
#> [4,] -2.507907 0.03496807
#>
#> $delta
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.4348687 0.02505645 -0.3258029 0.5082169 0.5382963 0.007687938
#> [2,] -0.2366798 0.59321185 1.1749236 -0.1194105 0.3109172 0.068670722
#> [3,] -0.3831418 0.56109098 0.1924961 -0.5279107 0.5833939 0.649129673
#> [4,] -0.4739807 -0.03943816 0.2924624 0.3115307 0.1336790 0.340314130
#> [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,] 0.04537578 -0.03529845 -0.6740836 0.4732525 0.003504127 0.2463430
#> [2,] 0.57107036 0.35288467 -0.6099253 0.1647277 0.325915901 0.1997869
#> [3,] 0.56472919 0.30824406 -0.1065357 1.0681196 -0.165072414 0.3466892
#> [4,] -0.80854374 -0.18491804 -0.8569132 -0.1587477 0.441429357 0.2841035
#>
#> $precW
#> [1] 0.0007380298 0.0009402290 0.0006374998 0.0006963610
#>
#> $rho
#> [1] 0.1193680 0.1129187 0.2440825 0.1499421
#>
#>
#> Slot "options":
#> An object of class "McmcOptions"
#> Slot "iterations":
#> [1] 58
#>
#> Slot "burnin":
#> [1] 50
#>
#> Slot "step":
#> [1] 2
#>
#> Slot "rng_kind":
#> [1] "base::Mersenne-Twister"
#>
#> Slot "rng_seed":
#> [1] 1
#>
#>
# Create some data from the class `DataDual`.
plcb <- 0.001
my_data <- DataDual(
w = c(13, 77, 86, 26, 27, 36, 37, 97, 21, 49, 87, 48),
x = c(plcb, 25, 25, 25, plcb, 50, 50, 50, plcb, 100, 100, 100),
y = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L),
doseGrid = c(plcb, seq(25, 300, 25)),
placebo = TRUE,
ID = 1:12,
cohort = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L)
)
# Initialize the CRM model.
my_model <- DualEndpointBeta(
mean = c(0, 1),
cov = diag(2),
ref_dose = 2,
use_log_dose = FALSE,
sigma2W = c(a = 1, b = 2),
rho = c(a = 1.5, b = 2.5),
E0 = 2,
Emax = 50,
delta1 = 6,
mode = 9,
ref_dose_beta = my_data@doseGrid[my_data@nGrid] + 10
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 50,
step = 2,
samples = 4,
rng_kind = "Mersenne-Twister",
rng_seed = 1
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
#> An object of class "Samples"
#> Slot "data":
#> $betaW
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#> [1,] 2 2.383076 2 2 2 2 2 2 2 2 2 2 2
#> [2,] 2 2.383076 2 2 2 2 2 2 2 2 2 2 2
#> [3,] 2 2.383076 2 2 2 2 2 2 2 2 2 2 2
#> [4,] 2 2.383076 2 2 2 2 2 2 2 2 2 2 2
#>
#> $betaZ
#> [,1] [,2]
#> [1,] -4.354759 0.09035452
#> [2,] -4.354759 0.09035452
#> [3,] -4.354759 0.09035452
#> [4,] -3.273111 0.08172139
#>
#> $precW
#> [1] 0.0004229406 0.0004149886 0.0004264222 0.0003413195
#>
#> $rho
#> [1] -0.5116824 -0.5902350 -0.5709147 -0.5230612
#>
#>
#> Slot "options":
#> An object of class "McmcOptions"
#> Slot "iterations":
#> [1] 58
#>
#> Slot "burnin":
#> [1] 50
#>
#> Slot "step":
#> [1] 2
#>
#> Slot "rng_kind":
#> [1] "base::Mersenne-Twister"
#>
#> Slot "rng_seed":
#> [1] 1
#>
#>
##obtain mcmc DLE samples given the data, LogisticIndepBeta (DLE model) and mcmc simulations options
## data must be of 'Data' class
data <- Data(
x = c(25, 50, 50, 75, 100, 100, 225, 300),
y = c(0, 0, 0, 0, 1, 1, 1, 1),
doseGrid = seq(25, 300, 25)
)
#> Used default patient IDs!
#> Used best guess cohort indices!
## model must be of 'LogisticIndepBeta' class
model <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = model, options = options)
# nolint start
##obtain mcmc efficacy samples given the data, 'Effloglog' model (efficacy model) and
## mcmc simulations options data must be of 'DataDual' class
data <- DataDual(
x = c(25, 50, 25, 50, 75, 300, 250, 150),
y = c(0, 0, 0, 0, 0, 1, 1, 0),
w = c(0.31, 0.42, 0.59, 0.45, 0.6, 0.7, 0.6, 0.52),
doseGrid = seq(25, 300, 25),
placebo = FALSE
)
#> Used default patient IDs!
#> Used best guess cohort indices!
## model must be of 'Effloglog' class
Effmodel <- Effloglog(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
nu = c(a = 1, b = 0.025),
data = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = Effmodel, options = options)
# nolint end
## obtain mcmc efficacy samples given the data, 'EffFlexi' model (efficacy model) and
## mcmc simulations options
## data must be of 'DataDual' class
data <- DataDual(
x = c(25, 50, 25, 50, 75, 300, 250, 150),
y = c(0, 0, 0, 0, 0, 1, 1, 0),
w = c(0.31, 0.42, 0.59, 0.45, 0.6, 0.7, 0.6, 0.52),
doseGrid = seq(25, 300, 25)
)
#> Used default patient IDs!
#> Used best guess cohort indices!
## model must be of 'EffFlexi' class
effmodel <- EffFlexi(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
sigma2W = c(a = 0.1, b = 0.1),
sigma2betaW = c(a = 20, b = 50),
rw1 = FALSE,
data = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = effmodel, options = options)
ordinal_data <- .DefaultDataOrdinal()
ordinal_model <- .DefaultLogisticLogNormalOrdinal()
mcmc_options <- .DefaultMcmcOptions()
samples <- mcmc(ordinal_data, ordinal_model, mcmc_options)
