
Get the Biomarker Levels for a Given Dual-Endpoint Model, Given Dose Levels and Samples
Source:R/Model-methods.R
biomarker.RdUsage
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. SeeDatafor 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.
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.
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.4326178 0.4299463 0.4479092 0.4939261 0.3853021 0.3356158 0.4256151
#> [8] 0.3878891 0.4725180 0.5472123 0.4150564 0.3718860 0.3334562 0.4076581
#> [15] 0.4339197 0.4769956 0.4324762 0.5225626 0.5157804 0.4902899 0.4188604
#> [22] 0.4291475 0.4782356 0.4356469 0.4659821 0.5012712 0.4668601 0.4110865
#> [29] 0.4097580 0.3804675 0.4417673 0.4839711 0.4750523 0.3554542 0.3952241
#> [36] 0.4298455 0.4551816 0.4189076 0.4930795 0.5139014 0.4675061 0.4660054
#> [43] 0.4737125 0.4313899 0.4333309 0.4192569 0.3002990 0.4038639 0.4304387
#> [50] 0.2732541 0.2830703 0.4527291 0.5289303 0.4273670 0.5262315 0.6346583
#> [57] 0.5096534 0.5537201 0.5420149 0.4859458 0.3070842 0.5617871 0.4977874
#> [64] 0.5386019 0.4658198 0.4521509 0.4637116 0.4731620 0.5624041 0.5398652
#> [71] 0.5983589 0.5218500 0.4868629 0.4724423 0.4406423 0.4468211 0.4038581
#> [78] 0.3495593 0.3703673 0.3491613 0.4000758 0.3992464 0.4289005 0.4821480
#> [85] 0.4248198 0.3747924 0.3997014 0.5646456 0.4533646 0.4250054 0.4832234
#> [92] 0.5010637 0.4311482 0.4478200 0.4562331 0.5563622 0.6727713 0.6985743
#> [99] 0.5616385 0.5901276 0.4493492 0.5401408 0.5386496 0.4788784 0.5169097
#> [106] 0.4098900 0.5045980 0.4768491 0.6684091 0.6237361 0.5337521 0.5283202
#> [113] 0.4463630 0.4487481 0.4336066 0.4436518 0.4680272 0.3706984 0.4098126
#> [120] 0.4460753 0.4236022 0.3864471 0.3627746 0.4761678 0.5278937 0.4050443
#> [127] 0.3801401 0.2885504 0.3596351 0.4377049 0.3552928 0.3231032 0.2074920
#> [134] 0.2933332 0.3103063 0.3150647 0.4532341 0.4318842 0.4320492 0.4678780
#> [141] 0.4618648 0.4138754 0.3970119 0.5184524 0.5068701 0.3910062 0.4690780
#> [148] 0.5172984 0.6403341 0.4917116 0.4761560 0.3848475 0.4616383 0.4072286
#> [155] 0.4862314 0.5157406 0.6077489 0.4660311 0.4113843 0.4210523 0.3753257
#> [162] 0.3860910 0.3467677 0.3121309 0.3148631 0.3313092 0.4172128 0.4605017
#> [169] 0.5472842 0.4884707 0.4259844 0.4121755 0.3850723 0.3728661 0.3668606
#> [176] 0.3116032 0.2810467 0.3572528 0.4060079 0.3576080 0.4576759 0.4173325
#> [183] 0.4321442 0.3760937 0.3790118 0.5006397 0.4370907 0.5108411 0.5329283
#> [190] 0.5213564 0.6338473 0.6809378 0.6730210 0.7127061 0.7385304 0.7257989
#> [197] 0.7465013 0.6180948 0.5039214 0.3510138 0.4084284 0.3097536 0.3377719
#> [204] 0.3280582 0.4420578 0.4489947 0.3805764 0.4006984 0.3994533 0.3861742
#> [211] 0.4871721 0.5238680 0.4595085 0.4918543 0.4126864 0.5135173 0.6314254
#> [218] 0.6254320 0.4091594 0.4438172 0.4074824 0.5509487 0.5285394 0.3987881
#> [225] 0.2369501 0.2954925 0.4117109 0.4984193 0.5273486 0.4076921 0.4298607
#> [232] 0.4129452 0.4807458 0.4257078 0.3640555 0.4006850 0.4114645 0.4833783
#> [239] 0.4190882 0.4049103 0.3692143 0.2587896 0.2927533 0.3015315 0.4351937
#> [246] 0.4327107 0.3691005 0.4554940 0.4574760 0.4695982 0.3698690 0.3355012
#> [253] 0.3038389 0.2894996 0.3534400 0.4128956 0.4675186 0.4902890 0.4274715
#> [260] 0.6103672 0.6342523 0.6440173 0.5983806 0.4601157 0.4982542 0.5288209
#> [267] 0.6096722 0.5165574 0.4855137 0.4133719 0.3204131 0.3584368 0.4183704
#> [274] 0.4752784 0.5286392 0.6004911 0.5808668 0.5572211 0.4627860 0.5578593
#> [281] 0.4439461 0.5109683 0.5484615 0.6294287 0.3239147 0.2614503 0.3859441
#> [288] 0.6067528 0.5558058 0.5398765 0.5321027 0.4431652 0.3947629 0.4092301
#> [295] 0.4491628 0.4738197 0.4549478 0.4524340 0.5486495 0.5922082 0.5450132
#> [302] 0.4376594 0.4187982 0.5611682 0.4467135 0.3348655 0.3707266 0.4641384
#> [309] 0.3977608 0.3787326 0.3528713 0.2805308 0.2417666 0.3011587 0.3287774
#> [316] 0.4517594 0.4379846 0.4303152 0.3463010 0.4084729 0.4475226 0.4275005
#> [323] 0.4628776 0.5083902 0.5517908 0.5923788 0.4407178 0.4364434 0.3751475
#> [330] 0.4578839 0.5316018 0.5758912 0.5596937 0.5287987 0.6207459 0.5329138
#> [337] 0.5186792 0.4335039 0.4099325 0.3928074 0.4612445 0.4839052 0.5199278
#> [344] 0.3411729 0.3690058 0.3758880 0.4618202 0.4881870 0.5367919 0.5169694
#> [351] 0.5899164 0.5845867 0.5291308 0.5153422 0.4939900 0.5114709 0.5421279
#> [358] 0.4751736 0.4158596 0.3789015 0.3848227 0.3817380 0.3621604 0.4491059
#> [365] 0.3991303 0.4608284 0.4514063 0.4314911 0.3722305 0.3870559 0.3238900
#> [372] 0.2516040 0.2666206 0.3411332 0.3372830 0.4422750 0.2592723 0.3141991
#> [379] 0.3531979 0.3277405 0.3131036 0.3283894 0.3703642 0.5830291 0.4854742
#> [386] 0.4339050 0.3222862 0.2406383 0.4088057 0.5104501 0.4941070 0.4590527
#> [393] 0.4614308 0.5129287 0.4594446 0.4415566 0.4164979 0.4488059 0.4210240
#> [400] 0.3960073 0.3524173 0.3815901 0.3604213 0.3106615 0.2709182 0.2593393
#> [407] 0.2582715 0.3063256 0.3117170 0.3103782 0.3307508 0.4433106 0.4328831
#> [414] 0.4293726 0.4789799 0.4677873 0.4207013 0.5006479 0.4574359 0.4472105
#> [421] 0.4756146 0.5509910 0.5953682 0.5801187 0.5472805 0.5058923 0.5145352
#> [428] 0.4832683 0.5145116 0.5545931 0.4232037 0.4222406 0.3823782 0.3923697
#> [435] 0.3726436 0.4135794 0.4464909 0.5040738 0.4645864 0.4747523 0.4628995
#> [442] 0.4251460 0.3423944 0.3803166 0.4956941 0.5157466 0.4592318 0.4736856
#> [449] 0.3975882 0.3923891 0.1346094 0.2096201 0.3057873 0.3476843 0.3929041
#> [456] 0.3111813 0.3217531 0.4509412 0.4666593 0.5836690 0.5472535 0.4086360
#> [463] 0.4949638 0.4121265 0.4163027 0.4953263 0.3244977 0.2964446 0.3292578
#> [470] 0.3226406 0.4997158 0.5265839 0.6090558 0.5762392 0.5878542 0.5106424
#> [477] 0.4430780 0.4026485 0.3257767 0.2357572 0.3989460 0.4758711 0.4521466
#> [484] 0.3686001 0.4361554 0.5020560 0.3911554 0.4278226 0.4232204 0.3856577
#> [491] 0.3734717 0.4034955 0.3333867 0.3091684 0.2794895 0.2375865 0.3207003
#> [498] 0.3282331 0.3363225 0.3282698