Skip to contents

[Stable]

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 GeneralData,GeneralModel,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for GeneralData,DualEndpointRW,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for GeneralData,DualEndpointBeta,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for GeneralData,DualEndpointEmax,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for GeneralData,OneParLogNormalPrior,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for GeneralData,OneParExpPrior,McmcOptions
mcmc(data, model, options, from_prior = data@nObs == 0L, ...)

# S4 method for DataMixture,GeneralModel,McmcOptions
mcmc(
  data,
  model,
  options,
  from_prior = data@nObs == 0L & data@nObsshare == 0L,
  ...
)

# S4 method for Data,LogisticIndepBeta,McmcOptions
mcmc(data, model, options, ...)

# S4 method for DataDual,Effloglog,McmcOptions
mcmc(data, model, options, ...)

# S4 method for DataDual,EffFlexi,McmcOptions
mcmc(data, model, options, ...)

# S4 method for DataOrdinal,LogisticLogNormalOrdinal,McmcOptions
mcmc(data, model, options, ...)

Arguments

data

(GeneralData)
an input data.

model

(GeneralModel)
an input model.

options

(McmcOptions)
MCMC options.

...

not used.

from_prior

(flag)
sample from the prior only? Default to TRUE when number of observations in data is 0. For some models it might be necessary to specify it manually here though.

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 the DualEndpointRW model, 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 the DualEndpointBeta model, it is required that the value of ref_dose_beta slot 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 in DualEndpointBeta model. 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 the DualEndpointEmax model, 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 the OneParLogNormalPrior model, 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 the OneParExpPrior model, 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 for DataMixture with different from_prior default

  • mcmc(data = Data, model = LogisticIndepBeta, options = McmcOptions): Obtain posterior samples for the model parameters based on the pseudo 'LogisticsIndepBeta' DLE 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) and TsuTakawa (1975). However, since asymptotically, the joint posterior probability density will be bivariate normal and we will use the bivariate normal distribution to generate posterior samples of the intercept and the slope parameters. For the prior samples of 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 the Efficacy log log model. 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 of nu will be first generated. Then the mean of the of the nu samples will be used the 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 the Efficacy Flexible form. 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 of sigma2 \(sigma^2\), the variance of the efficacy response and samples of sigma2betaW \(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, both sigma2 and sigma2betaW can be fixed or having 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 of sigma2 and sigma2betaW will be generated using the updated parameters.

  • mcmc( data = DataOrdinal, model = LogisticLogNormalOrdinal, options = McmcOptions ): Obtain the posterior samples for the model parameters in the LogisticLogNormalOrdinal.

    The generic mcmc method returns a Samples object with elements of the data slot named alpha[1], alpha[2], ..., alpha[k] and beta when passed a LogisticLogNormalOrdinal object. This makes the "alpha elements" awkward to access and is inconsistent with other Model objects. So rename the alpha elements to alpha1, 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.

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.305074152 -0.642988090 -0.642988090 -0.642988090 -0.642988090
#>    [6] -1.156412276 -1.156412276 -1.156412276 -1.156412276 -1.156412276
#>   [11] -1.156412276 -0.838886312  0.805878239  0.343259241  0.343259241
#>   [16]  0.343259241  0.255646436  0.255646436  0.255646436  0.255646436
#>   [21]  0.255646436  0.048079084  0.048079084  0.632969279  0.632969279
#>   [26]  0.045804957  0.045804957  0.956138781  0.956138781  0.478064748
#>   [31]  0.478064748 -0.655288183 -0.655288183 -0.273105071  0.524437023
#>   [36] -1.478286012 -0.491855622 -0.491855622 -0.491855622 -0.455829488
#>   [41] -0.455829488 -0.455829488 -0.455829488 -0.455829488 -0.455829488
#>   [46] -0.226594618 -1.233780834  0.697391550  0.697391550  0.697391550
#>   [51]  0.697391550  0.697391550  0.697391550  0.697391550  1.182361689
#>   [56]  1.182361689  1.182361689  1.182361689  1.645761900  1.645761900
#>   [61]  1.645761900  1.368751283  1.368751283  0.770515112  1.192622381
#>   [66]  1.192622381  1.286915457  1.286915457  1.286915457 -1.170360267
#>   [71] -1.170360267  0.577101514 -0.211967595 -0.211967595 -0.790975444
#>   [76]  1.098242135  0.490344020  0.490344020 -1.052794772 -1.052794772
#>   [81] -1.271803880  0.083230309  0.109276548  0.109276548  0.109276548
#>   [86]  0.109276548  0.109276548  1.180949619  0.868474087  0.467758007
#>   [91]  0.217759125  0.217759125  0.217759125  0.217759125  0.383637715
#>   [96]  0.383637715 -0.312884854 -0.358279532 -0.358279532 -0.358279532
#>  [101] -0.358279532 -0.477946712 -0.477946712 -0.477946712  0.222542826
#>  [106]  0.222542826  0.571019897  0.571019897  0.571019897  0.571019897
#>  [111]  0.571019897  0.022643746  0.874130888  0.236490163  0.236490163
#>  [116]  0.117173694  0.019617719  0.019617719 -0.119022727 -0.119022727
#>  [121] -0.119022727 -0.119022727 -0.075609320 -0.075609320 -0.075609320
#>  [126] -0.075609320 -0.385649173 -0.385649173 -0.189504019  1.155667653
#>  [131] -0.490975622  0.890594562  0.686376978 -0.271552109 -0.271552109
#>  [136]  0.359099800  0.491377381  0.079134245 -0.011357444 -0.255678928
#>  [141] -0.568963087 -0.568963087  0.654744298  0.903881264  0.903881264
#>  [146]  0.903881264  0.577718975  0.281261732  0.281261732  0.281261732
#>  [151]  0.281261732  0.281261732  0.281261732 -0.024157567 -0.024157567
#>  [156] -0.024157567 -0.024157567  0.479057632 -1.803256378 -0.544450187
#>  [161] -0.544450187 -0.544450187 -0.544450187 -0.544450187 -1.250513945
#>  [166] -1.250513945 -1.250513945 -1.027007583 -1.010926825 -1.010926825
#>  [171]  0.038888088  0.038888088 -0.092701635 -0.092701635 -1.181087898
#>  [176] -1.181087898 -1.181087898 -1.181087898 -2.043832824 -2.043832824
#>  [181] -1.705918657  0.587214765 -0.305005252 -0.305005252 -0.305005252
#>  [186] -1.162836014 -0.396194333  0.605595743  0.239774815  0.239774815
#>  [191]  0.551251790  0.551251790  0.551251790  0.551251790 -0.249581638
#>  [196]  0.230619539  0.230619539  0.230619539  0.230619539  0.230619539
#>  [201]  0.691685809  0.691685809  0.691685809  0.691685809  0.691685809
#>  [206]  0.691685809  0.691685809  0.691685809  1.062052914  0.511744664
#>  [211]  0.511744664  0.511744664  0.511744664 -0.630497820 -0.630497820
#>  [216] -0.630497820  0.330476999  0.330476999 -0.510976281 -1.087464342
#>  [221] -0.375511793 -0.375511793 -1.592209927 -0.412502084 -0.320096573
#>  [226] -0.320096573 -0.320096573 -0.320096573 -0.320096573 -0.533144341
#>  [231] -1.198183890 -1.198183890 -1.198183890 -1.198183890 -1.198183890
#>  [236] -1.198183890 -1.198183890 -1.198183890 -1.271700227 -1.271700227
#>  [241]  0.457823792  0.473630806  0.473630806 -0.527002816 -0.527002816
#>  [246]  0.792939150  0.792939150  0.792939150  0.792939150  0.792939150
#>  [251]  0.758129790  0.758129790 -0.175918623 -0.175918623 -0.175918623
#>  [256]  0.966628061  0.966628061 -0.932881086 -0.317411481  0.135331269
#>  [261]  0.135331269  0.135331269 -0.053278661 -0.053278661 -0.053278661
#>  [266] -0.053278661 -1.347496444  0.888821797  1.105955616 -0.748684521
#>  [271] -0.121461656  0.985877411  0.985877411  0.985877411  0.985877411
#>  [276] -0.165281426  1.610612367  0.755118850  0.755118850  0.755118850
#>  [281] -0.340977890 -0.340977890 -0.340977890 -0.340977890 -0.340977890
#>  [286] -0.340977890 -0.340977890 -0.340977890 -1.535833965 -0.089907864
#>  [291] -0.360390783 -0.419077063 -0.419077063 -0.419077063  0.548735051
#>  [296]  0.548735051 -0.348078389 -0.348078389  0.489669959 -0.248474988
#>  [301] -0.248474988 -0.248474988 -0.248474988 -0.248474988  0.050579001
#>  [306]  0.050579001  0.050579001  0.050579001  0.050579001 -0.036228497
#>  [311] -0.036228497 -0.036228497 -0.380799181 -0.190164518  0.456046085
#>  [316]  0.456046085  0.456046085  0.456046085  0.456046085  0.456046085
#>  [321] -0.438869949 -1.045371780  0.770152852 -1.386948495 -0.893983848
#>  [326]  0.189892833  0.189892833  0.760144049  0.563396495 -1.146741635
#>  [331]  0.079322619  0.079322619  0.079322619  0.079322619 -0.744483481
#>  [336] -0.056873415 -0.056873415 -0.056873415 -0.056873415 -0.056873415
#>  [341] -0.056873415 -0.056873415  0.037336176  0.037336176 -1.041499822
#>  [346] -1.041499822 -1.041499822 -1.041499822 -1.041499822 -1.027843386
#>  [351] -1.027843386 -1.027843386 -1.027843386 -1.027843386  1.362255146
#>  [356]  1.235139661  1.235139661  1.235139661 -0.150468128 -0.150468128
#>  [361] -0.155978266 -0.155978266 -0.155978266  0.807406150  0.807406150
#>  [366]  0.807406150  0.807406150 -0.927599694 -0.698413304 -0.698413304
#>  [371] -1.049319177 -1.049319177 -1.049319177 -1.049319177 -1.049319177
#>  [376] -1.049319177 -1.534902428 -1.534902428 -1.406292180 -1.406292180
#>  [381] -0.884446301  0.058912093 -0.318063847 -0.318063847 -0.318063847
#>  [386] -0.318063847 -0.318063847 -0.318063847 -0.318063847 -0.458181844
#>  [391] -0.458181844  1.069341974  0.070160624  0.106375527  0.106375527
#>  [396]  0.106375527  0.106375527  0.106375527  1.645226477 -0.256083332
#>  [401] -0.256083332 -0.256083332 -0.256083332 -1.224497065  0.073663885
#>  [406]  0.073663885  0.073663885  0.429704996  0.429704996  0.429704996
#>  [411]  0.429704996  0.018346454  1.075477648  0.397783330  0.802857766
#>  [416]  0.103174057 -0.509697343 -0.509697343 -0.509697343 -0.509697343
#>  [421] -0.509697343 -0.509697343 -0.509697343 -1.318406065 -1.318406065
#>  [426] -0.599361967 -0.599361967 -0.599361967 -0.599361967 -0.599361967
#>  [431] -0.599361967 -0.879229124 -1.217549843 -1.217549843 -0.514034923
#>  [436] -0.514034923 -0.514034923 -0.283614244 -0.900094596 -0.900094596
#>  [441]  1.579817824  1.579817824 -0.147567385  0.399046624  0.218033608
#>  [446] -0.108610166 -0.108610166 -0.836552867  0.192845340 -0.969437493
#>  [451] -0.065204727 -0.106653538 -0.106653538 -0.106653538 -0.106653538
#>  [456] -0.106653538 -0.106653538 -0.106653538 -1.589280734 -1.749503097
#>  [461] -0.348713431 -0.606284859 -0.606284859 -0.606284859 -1.247606730
#>  [466]  0.844375790  0.844375790  0.199601734  0.246844866  0.246844866
#>  [471]  0.246844866  0.246844866  0.246844866  0.246844866  0.246844866
#>  [476] -0.039972808 -0.039972808  0.444261340  0.444261340  0.444261340
#>  [481]  0.444261340  0.444261340  0.444261340  0.444261340 -0.560119554
#>  [486] -0.382798086  1.100439040 -0.474165849 -1.112007408 -0.646015213
#>  [491] -0.646015213 -0.794346839 -0.794346839  0.278831565  0.278831565
#>  [496]  0.278831565  0.278831565  0.278831565  0.696162840  0.696162840
#>  [501]  0.696162840  0.696162840  0.696162840  0.696162840  0.696162840
#>  [506]  0.696162840  0.227723075 -0.241890802 -1.092507571 -1.092507571
#>  [511] -0.039147467  0.006484397  0.864278215 -1.367720465 -0.794890660
#>  [516] -0.794890660 -1.531902351 -1.700258030 -1.437571585 -1.437571585
#>  [521] -0.633589054 -0.633589054  0.053213350 -0.893638868 -0.893638868
#>  [526] -0.893638868 -0.893638868  0.139270591 -0.726048636 -0.193040394
#>  [531] -0.265057399 -1.082240538 -0.629399272 -0.629399272 -1.491923606
#>  [536] -1.491923606  0.855242327  0.855242327  0.764563346  0.764563346
#>  [541]  0.764563346  0.223678794  0.223678794  0.223678794  0.342413275
#>  [546]  0.342413275 -0.720670297 -0.797598496 -0.797598496  0.019471876
#>  [551]  0.019471876 -0.461074096  0.296986676  0.296986676  0.296986676
#>  [556]  0.964765478  0.964765478 -0.237143751  0.218791558  0.218791558
#>  [561]  0.218791558  0.218791558  0.218791558  0.218791558  0.218791558
#>  [566]  0.218791558  0.218791558  0.218791558  0.218791558  0.218791558
#>  [571]  0.218791558  0.218791558  0.218791558  0.218791558  0.218791558
#>  [576] -0.031336661 -0.031336661 -0.031336661 -0.031336661 -0.031336661
#>  [581] -0.031336661 -0.031336661 -0.031336661 -0.790187596 -0.790187596
#>  [586] -1.953397422 -2.134676324 -2.037062027 -2.037062027 -1.880697917
#>  [591] -1.614251972  0.031330639  0.031330639  0.846932381  0.232505660
#>  [596]  0.232505660  0.232505660 -0.250037745 -0.250037745 -0.250037745
#>  [601] -0.250037745  1.178851966 -0.404913421 -0.404913421 -0.634596896
#>  [606] -0.634596896 -0.135065020 -0.135065020 -0.666319186 -0.666319186
#>  [611] -0.381729173 -1.715379163 -1.715379163 -1.524420071  0.653251783
#>  [616] -0.190065163 -0.190065163 -0.190065163 -0.190065163 -0.829681900
#>  [621] -0.829681900 -0.011493107 -0.296916079  0.596738780  0.596738780
#>  [626] -0.496696504  0.517546085  0.840947515  0.840947515 -0.003219148
#>  [631] -0.003219148 -0.003219148  0.230867537 -0.842913380 -0.448361065
#>  [636] -0.685975076 -0.247928502 -0.247928502 -0.136896567 -0.136896567
#>  [641] -0.136896567 -0.136896567  0.936860620  0.936860620  0.936860620
#>  [646]  0.936860620  0.486691936 -1.077392829 -1.077392829 -0.601109774
#>  [651] -0.158558558 -0.158558558 -0.158558558 -0.158558558 -1.114024676
#>  [656] -0.316736514 -0.753567137 -0.753567137 -0.753567137 -0.753567137
#>  [661] -0.225775844 -0.225775844 -0.225775844  1.063236234  0.010389165
#>  [666]  0.010389165  0.010389165 -0.546782541 -0.546782541 -0.546782541
#>  [671] -0.002327005 -0.002327005 -0.002327005 -0.488875204 -0.488875204
#>  [676] -0.488875204 -0.488875204 -0.488875204 -0.488875204  0.592428312
#>  [681]  0.218220864  0.289640395  0.246101582  0.348172101  0.348172101
#>  [686]  0.019037571 -0.360210389 -0.360210389 -0.360210389 -1.871543221
#>  [691] -1.202698957 -1.602521546 -1.340107347 -1.340107347 -1.340107347
#>  [696] -1.340107347 -1.340107347 -1.340107347 -1.340107347 -1.340107347
#>  [701] -0.098127857 -0.334509536 -0.430783290 -0.430783290 -0.896313479
#>  [706]  1.824223714  2.077577142  2.092633493 -0.836202437 -0.836202437
#>  [711] -0.836202437  1.023550041  1.023550041  1.023550041  1.023550041
#>  [716]  1.174361437  1.210706273  1.210706273  0.614451859  0.635686118
#>  [721]  0.635686118  2.143026578  2.143026578  1.979378875  1.552008957
#>  [726]  0.877161860  0.877161860 -0.420468653  0.541089340 -0.633875512
#>  [731]  0.073041447  0.073041447  0.094142699  0.094142699  0.094142699
#>  [736]  0.094142699  0.094142699 -0.391499634 -0.198251154 -0.198251154
#>  [741] -0.198251154 -0.198251154 -0.198251154 -0.198251154 -0.209365931
#>  [746] -0.209365931  0.685221762 -1.155751898 -1.155751898 -1.155751898
#>  [751] -1.155751898 -1.155751898 -1.155751898 -1.155751898 -1.029148493
#>  [756] -1.029148493 -1.029148493 -1.029148493 -1.387434351 -1.387434351
#>  [761] -0.342418125 -1.180670910 -1.180670910 -1.180670910 -1.180670910
#>  [766] -1.180670910 -1.399694832 -1.399694832 -1.399694832 -1.399694832
#>  [771] -1.722195310 -2.150408929  0.300139696  0.300139696  0.300139696
#>  [776]  0.300139696  0.300139696  0.300139696  0.300139696  0.300139696
#>  [781]  0.300139696  0.300139696  0.300139696  0.300139696  0.300139696
#>  [786] -1.071034114 -1.071034114 -1.239484425 -1.239484425 -0.251798535
#>  [791]  0.199946595  0.199946595  0.199946595  0.199946595  0.199946595
#>  [796]  0.199946595  0.199946595  0.199946595  0.199946595  0.428961210
#>  [801]  0.004420666  0.004420666 -1.433824264  0.103080149  0.993114257
#>  [806]  0.267664179 -0.892191224 -0.256160650 -0.478229763 -0.478229763
#>  [811] -0.478229763  0.754903723  0.754903723  0.428428082  0.428428082
#>  [816]  0.428428082 -0.683464269 -0.041849403 -1.158804011 -1.158804011
#>  [821] -1.861907095 -1.861907095 -1.994484379 -0.700884221 -0.700884221
#>  [826] -0.689566897 -0.315732548 -0.143548609 -0.143548609 -0.143548609
#>  [831] -0.143548609 -0.243282358 -0.682190353 -0.682190353 -1.428428013
#>  [836] -1.428428013  0.345630160  0.345630160  0.345630160  0.345630160
#>  [841] -0.287959352 -0.551721532  0.330855409  0.330855409  0.607236399
#>  [846] -0.365180566 -0.365180566 -0.688654709 -0.321864658 -0.321864658
#>  [851]  0.513651840  0.513651840  0.147247144  0.793100797  0.793100797
#>  [856]  0.793100797 -0.063228288 -0.063228288 -0.063228288 -0.063228288
#>  [861] -0.063228288 -0.063228288 -0.063228288 -0.063228288  0.266324307
#>  [866]  0.266324307  1.475577342  1.475577342  0.081535254  0.081535254
#>  [871] -0.475796160 -0.475796160 -0.475796160 -0.475796160 -0.808535664
#>  [876] -0.808535664 -0.808535664 -0.808535664  0.037169713  0.657929867
#>  [881]  0.657929867  0.657929867 -0.401987223 -0.401987223  1.251174766
#>  [886]  0.198035461 -0.263782732 -0.263782732 -0.421296488  0.348170665
#>  [891] -0.112546568 -0.215804272 -1.197627456 -1.197627456 -1.197627456
#>  [896] -1.197627456 -0.784394758 -0.642954394 -1.216451630 -1.216451630
#>  [901] -1.216451630 -1.216451630 -1.216451630 -0.991398563 -1.812541395
#>  [906]  0.952401127  0.308263951  0.631188361 -0.461179101  0.311936106
#>  [911]  1.804897127  1.804897127  1.804897127  1.804897127  0.423685224
#>  [916]  0.423685224 -0.380100438 -0.380100438 -0.380100438 -0.380100438
#>  [921] -0.380100438 -1.032722483 -1.032722483 -1.032722483 -1.030792421
#>  [926]  1.009747194  1.009747194  1.009747194  0.459563612 -0.497335429
#>  [931] -0.057589119 -0.057589119 -0.057589119 -0.057589119 -0.610382105
#>  [936]  1.627301674  1.627301674 -0.374495320 -0.202354568 -0.347800966
#>  [941] -0.347800966  0.681078372  0.614878466  0.614878466  0.614878466
#>  [946]  0.765796788  0.015974637  0.777862200  1.002198025  1.002198025
#>  [951] -0.001745768 -0.001745768 -0.480587466 -0.480587466 -0.480587466
#>  [956] -0.480587466 -0.480587466 -0.480587466 -0.480587466 -1.093262701
#>  [961]  0.672041003  0.672041003  0.058716033  0.426900435  0.426900435
#>  [966]  0.426900435  0.346553660  0.346553660 -0.656997178 -0.656997178
#>  [971]  0.378746673  0.126878402 -1.921139695 -1.921139695 -0.671478295
#>  [976] -0.671478295 -1.706519135 -0.949718661 -0.906297401 -0.906297401
#>  [981] -0.906297401 -0.110669293 -0.110669293 -0.372830016 -0.372830016
#>  [986] -0.372830016 -0.372830016 -0.372830016 -0.372830016 -0.372830016
#>  [991] -0.130803317 -0.130803317  0.273740929 -1.786519116 -1.786519116
#>  [996] -1.786519116 -1.839731794 -0.226892885 -0.226892885 -0.226892885
#> 
#> $alpha1
#>    [1] 2.0006694 1.3125156 1.3125156 1.3125156 1.3125156 1.3477457 1.3477457
#>    [8] 1.3477457 1.3477457 1.3477457 1.3477457 0.6127505 0.7251989 2.4300875
#>   [15] 2.4300875 2.4300875 0.4912659 0.4912659 0.4912659 0.4912659 0.4912659
#>   [22] 0.9401871 0.9401871 1.1564896 1.1564896 1.3236878 1.3236878 1.1025184
#>   [29] 1.1025184 1.3472498 1.3472498 0.7365583 0.7365583 0.3645923 0.9510991
#>   [36] 0.9666990 1.0134396 1.0134396 1.0134396 0.5154280 0.5154280 0.5154280
#>   [43] 0.5154280 0.5154280 0.5154280 1.0249220 1.3678543 0.9241540 0.9241540
#>   [50] 0.9241540 0.9241540 0.9241540 0.9241540 0.9241540 1.8941535 1.8941535
#>   [57] 1.8941535 1.8941535 1.6824865 1.6824865 1.6824865 1.8950603 1.8950603
#>   [64] 0.5940656 1.2506296 1.2506296 1.3382959 1.3382959 1.3382959 1.8826822
#>   [71] 1.8826822 0.9591451 1.3522681 1.3522681 0.9615232 1.0872565 1.3429260
#>   [78] 1.3429260 0.5057959 0.5057959 0.3367908 1.8486619 0.7447275 0.7447275
#>   [85] 0.7447275 0.7447275 0.7447275 0.9744337 1.3361078 2.3263538 1.3558906
#>   [92] 1.3558906 1.3558906 1.3558906 1.6391990 1.6391990 3.0539780 1.5245897
#>   [99] 1.5245897 1.5245897 1.5245897 0.9435663 0.9435663 0.9435663 0.9366233
#>  [106] 0.9366233 0.9988653 0.9988653 0.9988653 0.9988653 0.9988653 2.1756893
#>  [113] 1.4616314 2.1056438 2.1056438 2.4009498 1.1313177 1.1313177 1.3293830
#>  [120] 1.3293830 1.3293830 1.3293830 0.5502069 0.5502069 0.5502069 0.5502069
#>  [127] 0.8060700 0.8060700 2.3359954 1.8588676 0.2890654 1.0188486 1.0910631
#>  [134] 0.6165406 0.6165406 0.4449233 0.7490913 1.6219721 0.6943039 0.6793310
#>  [141] 1.3760133 1.3760133 0.5373876 1.6237756 1.6237756 1.6237756 0.8458499
#>  [148] 1.2259523 1.2259523 1.2259523 1.2259523 1.2259523 1.2259523 1.6509143
#>  [155] 1.6509143 1.6509143 1.6509143 0.6295587 2.3986106 1.2377538 1.2377538
#>  [162] 1.2377538 1.2377538 1.2377538 0.7407913 0.7407913 0.7407913 1.4768580
#>  [169] 1.8282377 1.8282377 2.3111755 2.3111755 1.3746331 1.3746331 1.5237836
#>  [176] 1.5237836 1.5237836 1.5237836 1.2289229 1.2289229 1.3670360 2.9246956
#>  [183] 3.0454264 3.0454264 3.0454264 1.3021565 0.5132414 2.0141800 0.8123778
#>  [190] 0.8123778 1.1831947 1.1831947 1.1831947 1.1831947 0.3980076 1.4167815
#>  [197] 1.4167815 1.4167815 1.4167815 1.4167815 0.6912254 0.6912254 0.6912254
#>  [204] 0.6912254 0.6912254 0.6912254 0.6912254 0.6912254 1.0610182 1.1561208
#>  [211] 1.1561208 1.1561208 1.1561208 0.7751534 0.7751534 0.7751534 1.1210252
#>  [218] 1.1210252 1.1756777 1.4207025 0.7272159 0.7272159 1.2928666 2.2035762
#>  [225] 1.7391553 1.7391553 1.7391553 1.7391553 1.7391553 1.9028293 2.2754001
#>  [232] 2.2754001 2.2754001 2.2754001 2.2754001 2.2754001 2.2754001 2.2754001
#>  [239] 1.0084630 1.0084630 1.4673026 1.6259285 1.6259285 1.3623823 1.3623823
#>  [246] 1.0880757 1.0880757 1.0880757 1.0880757 1.0880757 0.7270837 0.7270837
#>  [253] 0.8266569 0.8266569 0.8266569 1.6468237 1.6468237 2.2274264 0.5132497
#>  [260] 0.7543573 0.7543573 0.7543573 1.3969737 1.3969737 1.3969737 1.3969737
#>  [267] 0.5301743 1.4335544 0.5157155 0.4137280 0.9123012 1.1488287 1.1488287
#>  [274] 1.1488287 1.1488287 1.3819314 0.9547486 0.9353414 0.9353414 0.9353414
#>  [281] 1.8345447 1.8345447 1.8345447 1.8345447 1.8345447 1.8345447 1.8345447
#>  [288] 1.8345447 1.4439905 0.9312164 1.0896179 0.5562817 0.5562817 0.5562817
#>  [295] 1.6645400 1.6645400 2.4823283 2.4823283 1.1095552 0.9024466 0.9024466
#>  [302] 0.9024466 0.9024466 0.9024466 0.9163156 0.9163156 0.9163156 0.9163156
#>  [309] 0.9163156 1.3060059 1.3060059 1.3060059 0.9691603 1.2756420 1.4869299
#>  [316] 1.4869299 1.4869299 1.4869299 1.4869299 1.4869299 1.1694650 2.0950839
#>  [323] 1.0320701 0.8821734 1.6789289 0.3833740 0.3833740 0.6794468 2.5872874
#>  [330] 0.9062814 0.7151349 0.7151349 0.7151349 0.7151349 1.5109043 1.4847169
#>  [337] 1.4847169 1.4847169 1.4847169 1.4847169 1.4847169 1.4847169 2.3466512
#>  [344] 2.3466512 0.5238654 0.5238654 0.5238654 0.5238654 0.5238654 0.6578689
#>  [351] 0.6578689 0.6578689 0.6578689 0.6578689 1.7267881 0.9261351 0.9261351
#>  [358] 0.9261351 1.8143337 1.8143337 2.1214172 2.1214172 2.1214172 2.7310782
#>  [365] 2.7310782 2.7310782 2.7310782 3.4086367 2.2772320 2.2772320 1.2408687
#>  [372] 1.2408687 1.2408687 1.2408687 1.2408687 1.2408687 0.8151464 0.8151464
#>  [379] 0.6474948 0.6474948 0.7894631 1.5448277 1.0782089 1.0782089 1.0782089
#>  [386] 1.0782089 1.0782089 1.0782089 1.0782089 0.3843776 0.3843776 1.5298809
#>  [393] 2.1400448 1.9186134 1.9186134 1.9186134 1.9186134 1.9186134 1.9710705
#>  [400] 0.8881959 0.8881959 0.8881959 0.8881959 1.2821609 1.1470342 1.1470342
#>  [407] 1.1470342 1.3012267 1.3012267 1.3012267 1.3012267 2.7031432 1.0054199
#>  [414] 0.6852446 1.0292227 0.7954507 0.4599174 0.4599174 0.4599174 0.4599174
#>  [421] 0.4599174 0.4599174 0.4599174 1.0600737 1.0600737 0.6592788 0.6592788
#>  [428] 0.6592788 0.6592788 0.6592788 0.6592788 1.6217681 0.7874696 0.7874696
#>  [435] 2.2632595 2.2632595 2.2632595 1.2866483 0.5754424 0.5754424 1.3356058
#>  [442] 1.3356058 2.7170262 1.6796110 1.9260714 1.6865100 1.6865100 0.9839359
#>  [449] 1.5925051 0.7789921 1.1170050 1.3196826 1.3196826 1.3196826 1.3196826
#>  [456] 1.3196826 1.3196826 1.3196826 1.3631441 1.2629775 1.8370326 1.1243654
#>  [463] 1.1243654 1.1243654 1.6777670 1.7108611 1.7108611 2.3630575 1.0002678
#>  [470] 1.0002678 1.0002678 1.0002678 1.0002678 1.0002678 1.0002678 1.8891041
#>  [477] 1.8891041 1.7656305 1.7656305 1.7656305 1.7656305 1.7656305 1.7656305
#>  [484] 1.7656305 1.1576878 1.7495604 1.8392443 1.3844361 2.1902687 2.2839760
#>  [491] 2.2839760 1.9119154 1.9119154 1.3770327 1.3770327 1.3770327 1.3770327
#>  [498] 1.3770327 1.1647673 1.1647673 1.1647673 1.1647673 1.1647673 1.1647673
#>  [505] 1.1647673 1.1647673 1.2715245 0.7544063 1.1685484 1.1685484 2.8644732
#>  [512] 2.1930115 1.7242371 1.5327143 1.8170255 1.8170255 2.0162742 2.0117611
#>  [519] 0.7817904 0.7817904 0.9683468 0.9683468 0.8330796 1.6263244 1.6263244
#>  [526] 1.6263244 1.6263244 2.3307046 0.2773261 1.0055933 1.0029866 1.2157803
#>  [533] 1.9479321 1.9479321 0.8654497 0.8654497 1.0100706 1.0100706 1.2021216
#>  [540] 1.2021216 1.2021216 2.3116032 2.3116032 2.3116032 1.2547433 1.2547433
#>  [547] 1.0029150 0.9158371 0.9158371 0.7706787 0.7706787 1.0358871 0.8941016
#>  [554] 0.8941016 0.8941016 1.2465287 1.2465287 1.5316159 1.1696590 1.1696590
#>  [561] 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590
#>  [568] 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590 1.1696590
#>  [575] 1.1696590 1.4096455 1.4096455 1.4096455 1.4096455 1.4096455 1.4096455
#>  [582] 1.4096455 1.4096455 2.2738403 2.2738403 1.2585049 1.3199496 0.6068843
#>  [589] 0.6068843 0.6767440 0.7090679 2.6806444 2.6806444 1.2706841 0.4454566
#>  [596] 0.4454566 0.4454566 0.4586626 0.4586626 0.4586626 0.4586626 0.5952187
#>  [603] 0.6864009 0.6864009 1.3817211 1.3817211 0.8647980 0.8647980 1.4954079
#>  [610] 1.4954079 0.6433018 1.0175874 1.0175874 0.8762769 1.2928654 1.4075732
#>  [617] 1.4075732 1.4075732 1.4075732 1.6115069 1.6115069 0.5803993 2.5386283
#>  [624] 0.5160133 0.5160133 1.1381594 1.5364147 0.9791099 0.9791099 0.6924511
#>  [631] 0.6924511 0.6924511 0.7413599 0.4506500 2.5297589 1.6293653 0.9463593
#>  [638] 0.9463593 0.8111347 0.8111347 0.8111347 0.8111347 1.1730496 1.1730496
#>  [645] 1.1730496 1.1730496 0.6462862 0.5256080 0.5256080 1.1680611 0.7740591
#>  [652] 0.7740591 0.7740591 0.7740591 1.2603859 1.5598311 0.6377368 0.6377368
#>  [659] 0.6377368 0.6377368 0.9176766 0.9176766 0.9176766 0.9526803 0.8333288
#>  [666] 0.8333288 0.8333288 1.6609729 1.6609729 1.6609729 0.6547759 0.6547759
#>  [673] 0.6547759 1.4299171 1.4299171 1.4299171 1.4299171 1.4299171 1.4299171
#>  [680] 0.5542595 0.5142894 1.8049800 0.7864259 0.6174785 0.6174785 0.2462837
#>  [687] 1.9511123 1.9511123 1.9511123 0.3208896 0.8340984 0.6166516 0.3195279
#>  [694] 0.3195279 0.3195279 0.3195279 0.3195279 0.3195279 0.3195279 0.3195279
#>  [701] 0.3455514 0.3714584 2.0211064 2.0211064 2.5736872 2.4715644 1.3133494
#>  [708] 1.0692058 0.6954186 0.6954186 0.6954186 0.9734946 0.9734946 0.9734946
#>  [715] 0.9734946 2.5452098 1.4046898 1.4046898 2.0458762 1.6667960 1.6667960
#>  [722] 0.8772954 0.8772954 1.3994414 0.7354172 1.0025421 1.0025421 0.2865231
#>  [729] 0.3276616 1.0014035 1.3204971 1.3204971 0.6160153 0.6160153 0.6160153
#>  [736] 0.6160153 0.6160153 1.8479734 1.4357329 1.4357329 1.4357329 1.4357329
#>  [743] 1.4357329 1.4357329 1.5867955 1.5867955 2.3433025 1.4640150 1.4640150
#>  [750] 1.4640150 1.4640150 1.4640150 1.4640150 1.4640150 2.0425380 2.0425380
#>  [757] 2.0425380 2.0425380 1.5990294 1.5990294 0.4335172 1.2615125 1.2615125
#>  [764] 1.2615125 1.2615125 1.2615125 2.1049167 2.1049167 2.1049167 2.1049167
#>  [771] 1.0900072 1.3368886 1.4061127 1.4061127 1.4061127 1.4061127 1.4061127
#>  [778] 1.4061127 1.4061127 1.4061127 1.4061127 1.4061127 1.4061127 1.4061127
#>  [785] 1.4061127 1.2658065 1.2658065 1.7738617 1.7738617 0.4465739 1.0463687
#>  [792] 1.0463687 1.0463687 1.0463687 1.0463687 1.0463687 1.0463687 1.0463687
#>  [799] 1.0463687 1.2087053 0.4458764 0.4458764 0.9099435 0.4849162 0.6722174
#>  [806] 3.1476053 1.2582756 1.9367544 1.6262505 1.6262505 1.6262505 1.1023780
#>  [813] 1.1023780 1.3680060 1.3680060 1.3680060 1.8384177 1.0071866 1.3098566
#>  [820] 1.3098566 0.6966239 0.6966239 0.9416343 0.8811792 0.8811792 0.5783863
#>  [827] 0.7826498 2.4585311 2.4585311 2.4585311 2.4585311 2.8292232 1.8227092
#>  [834] 1.8227092 1.1946603 1.1946603 1.1983542 1.1983542 1.1983542 1.1983542
#>  [841] 1.1892175 0.5358694 1.1474226 1.1474226 1.4562876 0.9196270 0.9196270
#>  [848] 0.4650395 0.6071323 0.6071323 1.0139621 1.0139621 0.6842470 2.0432407
#>  [855] 2.0432407 2.0432407 1.1324884 1.1324884 1.1324884 1.1324884 1.1324884
#>  [862] 1.1324884 1.1324884 1.1324884 1.5849788 1.5849788 1.1034715 1.1034715
#>  [869] 0.8987011 0.8987011 0.6110565 0.6110565 0.6110565 0.6110565 0.9558988
#>  [876] 0.9558988 0.9558988 0.9558988 0.9252547 0.8489446 0.8489446 0.8489446
#>  [883] 1.0723421 1.0723421 1.0256200 0.3990430 0.8782914 0.8782914 0.8518990
#>  [890] 1.4547270 0.9896145 1.1059052 2.3429089 2.3429089 2.3429089 2.3429089
#>  [897] 0.8175050 0.2999445 0.4944720 0.4944720 0.4944720 0.4944720 0.4944720
#>  [904] 0.8140305 0.6601003 0.4851305 0.9900927 0.6504313 1.4959276 1.2356343
#>  [911] 2.1100336 2.1100336 2.1100336 2.1100336 1.5711769 1.5711769 0.9471216
#>  [918] 0.9471216 0.9471216 0.9471216 0.9471216 1.1271920 1.1271920 1.1271920
#>  [925] 2.8473408 1.8192707 1.8192707 1.8192707 0.5890291 0.8083288 0.2734926
#>  [932] 0.2734926 0.2734926 0.2734926 0.2202054 0.8281905 0.8281905 1.4587652
#>  [939] 1.6917542 1.0199529 1.0199529 1.0599595 1.5236881 1.5236881 1.5236881
#>  [946] 0.9710339 0.4011570 1.2908028 0.8642005 0.8642005 1.1916099 1.1916099
#>  [953] 0.8523601 0.8523601 0.8523601 0.8523601 0.8523601 0.8523601 0.8523601
#>  [960] 0.7148533 1.1404415 1.1404415 0.7766706 0.9143261 0.9143261 0.9143261
#>  [967] 1.1523170 1.1523170 1.3052856 1.3052856 0.6479977 0.6372385 0.7566789
#>  [974] 0.7566789 0.2164143 0.2164143 0.2707364 0.8921313 1.3252836 1.3252836
#>  [981] 1.3252836 0.5513357 0.5513357 1.0864078 1.0864078 1.0864078 1.0864078
#>  [988] 1.0864078 1.0864078 1.0864078 1.3097327 1.3097327 0.2616311 0.4857172
#>  [995] 0.4857172 0.4857172 0.6115034 0.9490268 0.9490268 0.9490268
#> 
#> 
#> 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)
#> Warning: Unused variable "y" in data