Skip to contents

[Experimental]

Usage

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

# S4 method for 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):

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.4521141 0.4306765 0.4155620 0.4476747 0.5016828 0.3970905 0.4487155
#>   [8] 0.4314030 0.4093891 0.3826961 0.3293065 0.2544046 0.4190613 0.4652002
#>  [15] 0.4601488 0.3696442 0.4278255 0.5252459 0.5369974 0.5654060 0.5912241
#>  [22] 0.6191594 0.5833924 0.5011107 0.5808909 0.4407982 0.3692818 0.4199460
#>  [29] 0.5011809 0.5249357 0.5287263 0.5826853 0.5749418 0.5396915 0.5396724
#>  [36] 0.5592705 0.4491000 0.5034887 0.4018662 0.2755518 0.3316401 0.2742238
#>  [43] 0.3480772 0.4275827 0.3902631 0.3672053 0.4096780 0.3480428 0.4205935
#>  [50] 0.4040051 0.4617939 0.4322785 0.4999933 0.4115542 0.5991581 0.6478208
#>  [57] 0.5369414 0.5598749 0.5645647 0.4284806 0.3014862 0.1639080 0.2548353
#>  [64] 0.3469014 0.3695446 0.3220182 0.3296183 0.3974626 0.4323936 0.5136703
#>  [71] 0.6066940 0.5599923 0.5502880 0.5415414 0.5466445 0.5254131 0.5788852
#>  [78] 0.5244422 0.5271460 0.5280899 0.4864691 0.4163320 0.4459684 0.3888074
#>  [85] 0.3226253 0.3382514 0.4205349 0.4763374 0.3603705 0.3429322 0.4304126
#>  [92] 0.5022363 0.6253590 0.6641223 0.6178785 0.5975455 0.5324829 0.3466889
#>  [99] 0.5888015 0.5880882 0.5886174 0.5114183 0.5197318 0.4981916 0.3804874
#> [106] 0.4653300 0.4967213 0.5986312 0.4972105 0.5817082 0.5487830 0.5324099
#> [113] 0.5239215 0.4507488 0.3168697 0.3004933 0.3664517 0.4450202 0.5113493
#> [120] 0.4911790 0.5085459 0.4757216 0.5335008 0.4077038 0.5053774 0.3655756
#> [127] 0.3284391 0.3568050 0.3262885 0.3800938 0.3876126 0.5667870 0.6117549
#> [134] 0.4916939 0.3724243 0.2776966 0.2744805 0.2881449 0.2103099 0.2723742
#> [141] 0.3227741 0.3379182 0.2647889 0.3048500 0.3033446 0.4426042 0.4614328
#> [148] 0.4380994 0.4702496 0.4983671 0.5046015 0.4914674 0.4562206 0.4122697
#> [155] 0.4396748 0.4355040 0.5235354 0.4671238 0.3967272 0.4479966 0.4336385
#> [162] 0.3936170 0.3456243 0.3394763 0.4468239 0.4308015 0.5067689 0.6033289
#> [169] 0.5155287 0.4017285 0.2053443 0.1370511 0.1851817 0.0754892 0.2596380
#> [176] 0.4790876 0.4352368 0.4851804 0.5645598 0.5852088 0.5591570 0.6005356
#> [183] 0.4785548 0.4824491 0.4530900 0.5170316 0.4529859 0.4291110 0.4668267
#> [190] 0.5033346 0.5121509 0.5239576 0.5494195 0.5712720 0.6037801 0.5298836
#> [197] 0.4896811 0.5327625 0.6197506 0.5637225 0.3666209 0.3418584 0.3353578
#> [204] 0.4176321 0.3660965 0.4222006 0.5032508 0.4051021 0.4215391 0.4517331
#> [211] 0.3613760 0.3847881 0.4588505 0.3746653 0.5452836 0.5060208 0.5026928
#> [218] 0.4516219 0.4866822 0.4923732 0.4285804 0.3859245 0.5413597 0.4477875
#> [225] 0.5724193 0.5170812 0.5723269 0.6338007 0.7306844 0.7831700 0.5875654
#> [232] 0.4050445 0.3934889 0.4084703 0.3935533 0.3882799 0.4155665 0.3038557
#> [239] 0.2946412 0.4027780 0.4490650 0.3680976 0.3613299 0.3826137 0.3977439
#> [246] 0.4092667 0.4058916 0.6051507 0.5034162 0.3689268 0.4754718 0.3821701
#> [253] 0.3737310 0.3779515 0.3999637 0.3602505 0.3898641 0.3530291 0.4661530
#> [260] 0.4250582 0.5212810 0.5234878 0.4704606 0.4043839 0.3945056 0.2519319
#> [267] 0.1605453 0.2483970 0.3897607 0.3822351 0.5062983 0.5730230 0.4958237
#> [274] 0.5624964 0.5834479 0.6148980 0.6251189 0.5466394 0.5101675 0.5708108
#> [281] 0.4974831 0.5062176 0.4805080 0.4741788 0.4949096 0.4555077 0.4282512
#> [288] 0.3601303 0.3838595 0.3673198 0.4443692 0.3350299 0.4234041 0.4054676
#> [295] 0.3527159 0.1474277 0.1998967 0.2505815 0.2645167 0.3880075 0.4825755
#> [302] 0.3595714 0.5427066 0.5030726 0.5762270 0.5696571 0.4241818 0.3682806
#> [309] 0.3816994 0.4834866 0.5244403 0.5969550 0.5807803 0.5987729 0.5686344
#> [316] 0.4598289 0.4348587 0.3981842 0.4139975 0.5063429 0.5418091 0.5426903
#> [323] 0.4761762 0.4662832 0.4400341 0.4441507 0.5580325 0.5224753 0.3554177
#> [330] 0.4483865 0.3975841 0.4519042 0.4190222 0.3816086 0.4048707 0.4495024
#> [337] 0.4670448 0.4820853 0.4272518 0.5184498 0.4894298 0.4412135 0.4443329
#> [344] 0.3828397 0.3785732 0.2814835 0.2998959 0.4186672 0.4104195 0.4999032
#> [351] 0.5001906 0.5373792 0.4505366 0.4895404 0.3591643 0.2351646 0.3033581
#> [358] 0.3010007 0.3384994 0.3320716 0.4072163 0.4456956 0.4860788 0.4109801
#> [365] 0.4719464 0.5322920 0.6274557 0.5233651 0.5498839 0.5939338 0.5275860
#> [372] 0.4853148 0.5232121 0.6268957 0.6317099 0.6633973 0.6637025 0.6666740
#> [379] 0.4203070 0.4438182 0.3763201 0.5138048 0.4788778 0.4841189 0.5172425
#> [386] 0.3496243 0.3537135 0.2701346 0.3179655 0.3209023 0.3900709 0.4602079
#> [393] 0.5172132 0.4925767 0.3386404 0.2207153 0.1851629 0.2328365 0.2759738
#> [400] 0.3235553 0.3503439 0.4445845 0.4443029 0.4072685 0.3788398 0.4222098
#> [407] 0.5567186 0.5407807 0.4692883 0.2948049 0.2636024 0.3397849 0.3422998
#> [414] 0.3562045 0.3884326 0.4235821 0.3623573 0.3386003 0.4539984 0.3948401
#> [421] 0.3722022 0.4498448 0.4612893 0.5398155 0.5047156 0.5341387 0.4907011
#> [428] 0.4976081 0.5125085 0.5317457 0.4881918 0.3694957 0.2897178 0.3231388
#> [435] 0.4034216 0.4012205 0.5242653 0.6196714 0.4004021 0.3108965 0.3595024
#> [442] 0.4629008 0.5303320 0.4718979 0.4363675 0.4443518 0.4823788 0.4452918
#> [449] 0.4546010 0.4432164 0.4525959 0.5068763 0.5245443 0.5173304 0.4517414
#> [456] 0.5575555 0.4807807 0.4849519 0.3635106 0.3535618 0.3916899 0.4152919
#> [463] 0.5231627 0.5017959 0.4265404 0.3547787 0.4410983 0.4473937 0.4530016
#> [470] 0.3749267 0.2835905 0.1915146 0.3120010 0.4041124 0.3631423 0.3998719
#> [477] 0.3546443 0.3966098 0.2550099 0.2624382 0.2966113 0.5436743 0.5298255
#> [484] 0.5412478 0.5366541 0.4883495 0.4533276 0.5055497 0.4807923 0.5752819
#> [491] 0.5624693 0.5698700 0.4964035 0.5430716 0.5297406 0.5038247 0.5237056
#> [498] 0.5031928 0.4828806 0.3166053