
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.5528828 0.5163280 0.4910850 0.4350678 0.3835891 0.3499187 0.4175596
#> [8] 0.4924731 0.4449364 0.4910024 0.5156982 0.5049448 0.5088317 0.4914463
#> [15] 0.3616994 0.4562521 0.4246431 0.4836786 0.5239543 0.4909146 0.5615931
#> [22] 0.5430661 0.5185147 0.5835457 0.6096330 0.5508290 0.6054388 0.5688974
#> [29] 0.5298192 0.4438867 0.4556847 0.3526900 0.2972290 0.4494542 0.5269363
#> [36] 0.3894616 0.4294721 0.4073518 0.3759634 0.3437071 0.3968846 0.3067278
#> [43] 0.3430101 0.4921975 0.5139252 0.3891798 0.4460649 0.4016309 0.3740702
#> [50] 0.4779417 0.3829173 0.4466130 0.4342012 0.5214708 0.5142035 0.5093721
#> [57] 0.4429601 0.3772132 0.3811534 0.3425002 0.3623923 0.3713992 0.4810381
#> [64] 0.4267289 0.5133013 0.3610428 0.4974252 0.4171807 0.3629414 0.2699114
#> [71] 0.2608870 0.4165475 0.4984432 0.5113563 0.4212051 0.3256751 0.4104476
#> [78] 0.4942356 0.3484182 0.5507612 0.6300938 0.5943095 0.6293513 0.5192294
#> [85] 0.6612114 0.6217609 0.4918211 0.5145633 0.3761830 0.3219580 0.3759829
#> [92] 0.4167487 0.4082442 0.3738528 0.3333812 0.4538259 0.4502422 0.4901184
#> [99] 0.5094667 0.4995284 0.3947131 0.5418650 0.4860605 0.4103035 0.5881647
#> [106] 0.5464625 0.4722519 0.3800596 0.4156802 0.2482250 0.2583815 0.2552975
#> [113] 0.3075247 0.4273334 0.3878030 0.4850460 0.5205705 0.5083765 0.4790902
#> [120] 0.5654664 0.5546793 0.4884622 0.4988711 0.4827535 0.3932690 0.3703988
#> [127] 0.4473874 0.4064632 0.4124936 0.3683266 0.2525346 0.1847759 0.2373731
#> [134] 0.2732147 0.3666305 0.3103710 0.2630508 0.3209089 0.2976905 0.2867320
#> [141] 0.3135733 0.3826815 0.4617214 0.5299125 0.5267197 0.4782681 0.4584488
#> [148] 0.4560861 0.4211769 0.3559820 0.3123519 0.4388981 0.5162058 0.5625245
#> [155] 0.5274198 0.5107441 0.4706591 0.4577316 0.3432558 0.3548903 0.2330174
#> [162] 0.2387588 0.1829142 0.2333476 0.2361254 0.2774404 0.3061162 0.3727896
#> [169] 0.3874922 0.5062879 0.4667715 0.5181584 0.5452922 0.4390008 0.5217793
#> [176] 0.4899481 0.4314155 0.4123752 0.4700031 0.4944964 0.4683806 0.4963826
#> [183] 0.4343424 0.4206446 0.4603671 0.4696728 0.4804186 0.5494722 0.5790703
#> [190] 0.5305545 0.4771105 0.5078074 0.6066254 0.3760480 0.3431618 0.4214307
#> [197] 0.4189033 0.3956972 0.4157866 0.4158175 0.4593433 0.4603419 0.4272836
#> [204] 0.4898646 0.5813628 0.5328559 0.4111351 0.3036045 0.3316464 0.3268836
#> [211] 0.4819317 0.3977261 0.4438706 0.4239823 0.3854610 0.4591589 0.4196188
#> [218] 0.3541733 0.3624313 0.3982972 0.4105438 0.3813399 0.4324228 0.4684401
#> [225] 0.6430451 0.6040991 0.5159945 0.4670020 0.4133488 0.5120736 0.4624170
#> [232] 0.4588998 0.4057500 0.4582891 0.4441333 0.3445466 0.3993330 0.4161722
#> [239] 0.4540795 0.5020936 0.4309962 0.4211528 0.4329250 0.3760154 0.4079830
#> [246] 0.4400402 0.6373573 0.6270055 0.5073310 0.5164785 0.6348109 0.5438144
#> [253] 0.5385962 0.6165728 0.5732389 0.4871052 0.4101952 0.4561063 0.4982358
#> [260] 0.4172692 0.3785044 0.3552834 0.3794817 0.3105378 0.3775858 0.4416920
#> [267] 0.4721496 0.4837272 0.5846974 0.5824085 0.5518321 0.5901757 0.5748769
#> [274] 0.5048777 0.3973059 0.4501747 0.4746019 0.4446169 0.3111696 0.3096943
#> [281] 0.2315985 0.4644879 0.5105341 0.5466418 0.4614687 0.4300120 0.3599888
#> [288] 0.3926030 0.2625402 0.2264671 0.2956250 0.4172494 0.4491508 0.3600237
#> [295] 0.5294047 0.4293179 0.3723938 0.4000280 0.4250095 0.4573038 0.4268475
#> [302] 0.4579332 0.4516012 0.4491743 0.4140286 0.2850704 0.2621004 0.2170446
#> [309] 0.2261512 0.2464828 0.2427174 0.3180349 0.2739321 0.2783708 0.3547237
#> [316] 0.4506039 0.3890593 0.4868636 0.5227922 0.4837200 0.4950605 0.4542062
#> [323] 0.3221310 0.2781192 0.3210941 0.2511741 0.2959905 0.3172930 0.3026000
#> [330] 0.3256489 0.2962105 0.3062428 0.2771183 0.2647789 0.2267488 0.1299160
#> [337] 0.2649428 0.3329632 0.3357993 0.2702954 0.3762890 0.5835427 0.5991769
#> [344] 0.6267287 0.5501434 0.6174280 0.6449043 0.5789797 0.5337939 0.4213741
#> [351] 0.4172936 0.4188957 0.4738223 0.3682346 0.3423596 0.3118680 0.3563872
#> [358] 0.4133530 0.5399844 0.3966776 0.5388255 0.4863633 0.5031276 0.4730785
#> [365] 0.5062919 0.4871656 0.3798074 0.2875961 0.2861775 0.2916444 0.2983525
#> [372] 0.2976820 0.4076818 0.4195791 0.4583783 0.4113235 0.4944505 0.4426590
#> [379] 0.4571011 0.4826004 0.3887652 0.3726470 0.4247379 0.4345650 0.4510233
#> [386] 0.4836171 0.5688619 0.6367714 0.6307553 0.5804711 0.5626102 0.5335409
#> [393] 0.5704767 0.4514992 0.4012132 0.3529503 0.3126930 0.3843574 0.3377853
#> [400] 0.2459612 0.2473499 0.3407907 0.1330103 0.1389877 0.3027177 0.3574434
#> [407] 0.4028300 0.4236789 0.4972309 0.4534809 0.4384402 0.5266023 0.5931628
#> [414] 0.5149892 0.5474671 0.4800179 0.5500285 0.5562928 0.5608591 0.5026782
#> [421] 0.4640847 0.4482470 0.3763242 0.3732100 0.3673457 0.4325483 0.4932122
#> [428] 0.4943399 0.4820413 0.4107757 0.5275235 0.5019534 0.5273541 0.5410819
#> [435] 0.4811269 0.4542267 0.3189777 0.2781638 0.2261664 0.2041201 0.2581465
#> [442] 0.3341723 0.3824411 0.3802824 0.3940416 0.4260976 0.3735847 0.3962402
#> [449] 0.4601573 0.4685851 0.4005771 0.3239004 0.2712606 0.2315458 0.2746917
#> [456] 0.1987010 0.3008101 0.4135764 0.3154815 0.3498886 0.5024768 0.5000739
#> [463] 0.5423848 0.5625978 0.5211205 0.6351216 0.5723770 0.6094500 0.6449905
#> [470] 0.5784374 0.4671678 0.4912159 0.4263180 0.4401655 0.4394332 0.3821589
#> [477] 0.3095740 0.3934031 0.4620682 0.4899165 0.4502892 0.3671014 0.4388595
#> [484] 0.4546985 0.2980945 0.3312980 0.4488938 0.5042933 0.4414079 0.3319313
#> [491] 0.3560330 0.3090391 0.3078790 0.3178497 0.4061164 0.4580217 0.4825078
#> [498] 0.4924292 0.4963898 0.5666685