Skip to contents

[Experimental]

Usage

biomarker(xLevel, model, samples, ...)

# S4 method for class 'integer,DualEndpoint,Samples'
biomarker(xLevel, model, samples, ...)

Arguments

xLevel

(integer)
the levels for the doses the patients have been given w.r.t dose grid. See Data for more details.

model

(DualEndpoint)
the model.

samples

(Samples)
the samples of model's parameters that store the value of biomarker levels for all doses on the dose grid.

...

not used.

Value

The biomarker levels.

Details

This function simply returns a specific columns (with the indices equal to xLevel) of the biomarker samples matrix, which is included in the the samples object.

Functions

  • biomarker(xLevel = integer, model = DualEndpoint, samples = Samples): Extract biomarker values for a DualEndpoint model.

Examples

# Create the data.
my_data <- DataDual(
  x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10, 20, 20, 20, 40, 40, 40, 50, 50, 50),
  y = c(0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1),
  ID = 1:17,
  cohort = c(
    1L,
    2L,
    3L,
    4L,
    5L,
    6L,
    6L,
    6L,
    7L,
    7L,
    7L,
    8L,
    8L,
    8L,
    9L,
    9L,
    9L
  ),
  w = c(
    0.31,
    0.42,
    0.59,
    0.45,
    0.6,
    0.7,
    0.55,
    0.6,
    0.52,
    0.54,
    0.56,
    0.43,
    0.41,
    0.39,
    0.34,
    0.38,
    0.21
  ),
  doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)

# Initialize the Dual-Endpoint model (in this case RW1).
my_model <- DualEndpointRW(
  mean = c(0, 1),
  cov = matrix(c(1, 0, 0, 1), nrow = 2),
  sigma2betaW = 0.01,
  sigma2W = c(a = 0.1, b = 0.1),
  rho = c(a = 1, b = 1),
  rw1 = TRUE
)

# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(
  burnin = 100,
  step = 2,
  samples = 500
)
my_samples <- mcmc(my_data, my_model, my_options)

# Obtain the biomarker levels (samples) for the second dose from the dose grid,
# which is 0.5.
biomarker(
  xLevel = 2L,
  model = my_model,
  samples = my_samples
)
#>   [1] 0.4038130 0.4322471 0.3531634 0.3699179 0.2451693 0.2807547 0.3273738
#>   [8] 0.3566830 0.2926159 0.2985454 0.2971184 0.4237053 0.5802074 0.4563528
#>  [15] 0.5325722 0.5488394 0.4988488 0.5066421 0.4701081 0.4915885 0.4750216
#>  [22] 0.4703094 0.3609457 0.3954402 0.2352808 0.3331986 0.3398866 0.4202854
#>  [29] 0.5319674 0.4119357 0.4201751 0.3855305 0.4225959 0.4494362 0.4179615
#>  [36] 0.3294065 0.3955301 0.4306930 0.2423275 0.2552459 0.2558719 0.1954347
#>  [43] 0.2554038 0.3031909 0.3739688 0.3994698 0.5257005 0.4822934 0.5105143
#>  [50] 0.4634430 0.4838357 0.5460454 0.4815778 0.4599154 0.4516235 0.4283324
#>  [57] 0.4392994 0.3617795 0.3439229 0.3524834 0.4302031 0.3674782 0.3668725
#>  [64] 0.3153525 0.3216794 0.3461295 0.3680340 0.3575936 0.3503162 0.4388343
#>  [71] 0.5306164 0.4837096 0.4584571 0.4661356 0.3493033 0.3775043 0.4355626
#>  [78] 0.3389296 0.4533997 0.4078297 0.3413429 0.2917989 0.3545775 0.3841738
#>  [85] 0.3792971 0.4697974 0.2913803 0.2270004 0.3445554 0.3661223 0.4222204
#>  [92] 0.5863476 0.5868776 0.5452225 0.5073304 0.3517077 0.3950029 0.3895539
#>  [99] 0.4111618 0.3796307 0.4907459 0.4172727 0.4436630 0.4449507 0.3659310
#> [106] 0.3218030 0.4489786 0.2898061 0.2486438 0.3107926 0.3767829 0.4981461
#> [113] 0.4949018 0.5334838 0.4645480 0.4517081 0.4159978 0.5378924 0.5146362
#> [120] 0.4968300 0.4984823 0.4008880 0.3771001 0.3596694 0.4488107 0.5165430
#> [127] 0.5207606 0.4080395 0.4101124 0.4455324 0.4344026 0.5020010 0.5269298
#> [134] 0.4192954 0.4650388 0.4127104 0.3401774 0.3126545 0.2480526 0.3551269
#> [141] 0.3173348 0.3646315 0.4479842 0.4413194 0.3994403 0.4098504 0.3783075
#> [148] 0.3690179 0.4065544 0.4268315 0.4889716 0.4311459 0.4163450 0.4226975
#> [155] 0.3111860 0.4475870 0.4109929 0.5247652 0.5023800 0.4659885 0.4249322
#> [162] 0.5211662 0.4610300 0.3496500 0.3445192 0.3982439 0.4445062 0.4383666
#> [169] 0.2383994 0.3353183 0.3133209 0.3643675 0.4000707 0.4251646 0.4237705
#> [176] 0.4469010 0.4867270 0.5344521 0.4626889 0.4382092 0.3819861 0.4389594
#> [183] 0.4821983 0.4848683 0.4418136 0.5262784 0.5003154 0.5515926 0.4458138
#> [190] 0.4546196 0.3205097 0.3997151 0.4370825 0.5009397 0.4064801 0.3860203
#> [197] 0.3162056 0.3661592 0.3631317 0.2784546 0.2328406 0.2700351 0.4086508
#> [204] 0.4659575 0.4222694 0.4117049 0.3707721 0.3640281 0.4033139 0.4643584
#> [211] 0.4978195 0.5054847 0.4429228 0.3867081 0.3285765 0.3721729 0.3447556
#> [218] 0.3850504 0.4030586 0.4586600 0.4087480 0.3098890 0.3325642 0.3233608
#> [225] 0.2283168 0.2777527 0.3694942 0.3793188 0.3969491 0.4636684 0.4798111
#> [232] 0.5520793 0.5241908 0.5269515 0.5051610 0.5026287 0.4804771 0.4650233
#> [239] 0.4354186 0.4230367 0.4289646 0.4001088 0.3766526 0.4451489 0.4317657
#> [246] 0.5228002 0.4717565 0.5057958 0.5426880 0.5365767 0.5878748 0.5412374
#> [253] 0.5570648 0.5595519 0.4397201 0.3817866 0.3755506 0.4652599 0.4766586
#> [260] 0.5111964 0.5607362 0.5016284 0.5237850 0.5101340 0.4350170 0.4621276
#> [267] 0.4963976 0.5964462 0.5365472 0.4645402 0.4028398 0.3472206 0.2677795
#> [274] 0.3615382 0.4590032 0.5152180 0.5017269 0.5458777 0.5004903 0.4531581
#> [281] 0.4089247 0.3398642 0.4064014 0.4434076 0.4741751 0.4785716 0.5551155
#> [288] 0.5980989 0.4573904 0.3957149 0.4562233 0.4631385 0.5148576 0.4717482
#> [295] 0.5440417 0.4515404 0.4855026 0.5637321 0.5956249 0.6439908 0.4575945
#> [302] 0.5098781 0.6443108 0.7040262 0.6708206 0.8057825 0.5144062 0.5024501
#> [309] 0.3980866 0.3739854 0.3163683 0.3741832 0.2980894 0.2912950 0.2391876
#> [316] 0.2430044 0.2886530 0.2383935 0.2437365 0.2158823 0.3739301 0.6013938
#> [323] 0.6267484 0.5264887 0.3816580 0.3384260 0.3609645 0.4048218 0.4397080
#> [330] 0.4912846 0.4547242 0.4597397 0.4324736 0.4183148 0.4512291 0.4022265
#> [337] 0.3652022 0.3426477 0.4364219 0.4850169 0.4688357 0.4507730 0.4183431
#> [344] 0.3966122 0.3783947 0.4496164 0.4744812 0.5128909 0.4131371 0.3822008
#> [351] 0.3725024 0.3795766 0.3604087 0.4146072 0.3232432 0.4279795 0.4769259
#> [358] 0.5400951 0.4736410 0.4277034 0.5434015 0.5051938 0.5191198 0.4426608
#> [365] 0.4109204 0.3181098 0.3490164 0.4176487 0.4598829 0.4082580 0.3494247
#> [372] 0.4192730 0.4703712 0.4241741 0.4728238 0.4944310 0.4947668 0.4716704
#> [379] 0.4166590 0.4207371 0.4107128 0.4093984 0.4656926 0.5023574 0.4512636
#> [386] 0.5363444 0.5302429 0.5746762 0.4407552 0.2606789 0.1604286 0.3393644
#> [393] 0.2957250 0.3062780 0.2154614 0.1893855 0.3415370 0.3409402 0.4085631
#> [400] 0.4654029 0.5308533 0.5017722 0.4776739 0.5090671 0.5348832 0.4360810
#> [407] 0.4020786 0.4236095 0.3463781 0.4202234 0.4964406 0.6010468 0.4404087
#> [414] 0.4098851 0.3298954 0.3682187 0.4684648 0.4382802 0.3148340 0.3584654
#> [421] 0.4490737 0.5117546 0.4694831 0.4253826 0.4131560 0.4128051 0.4230176
#> [428] 0.3300272 0.3595739 0.3325963 0.3437985 0.4002902 0.3557582 0.3977552
#> [435] 0.2973105 0.2430383 0.2815050 0.2703256 0.4103647 0.5522627 0.4242023
#> [442] 0.3147363 0.3518412 0.3654675 0.4480469 0.4206943 0.3628481 0.3810399
#> [449] 0.3285467 0.4462899 0.4875031 0.4391059 0.4327317 0.4232919 0.4259351
#> [456] 0.4019170 0.4483014 0.5229104 0.4667451 0.4708574 0.3848565 0.4231129
#> [463] 0.3518551 0.3663843 0.3751944 0.3916058 0.3765668 0.3468980 0.3520671
#> [470] 0.2702229 0.3443909 0.3477955 0.2738673 0.3701205 0.3508548 0.4160816
#> [477] 0.4021249 0.5278589 0.5200453 0.4678583 0.4860072 0.4102701 0.4840349
#> [484] 0.4779589 0.3806355 0.3472304 0.3528895 0.4105543 0.4833048 0.5502523
#> [491] 0.4952504 0.4211686 0.4376779 0.5197605 0.4390876 0.4805931 0.3975849
#> [498] 0.4198013 0.4545737 0.4168157