
Get the Biomarker Levels for a Given Dual-Endpoint Model, Given Dose Levels and Samples
Source:R/Model-methods.R
biomarker.Rd
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. SeeData
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.
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.3371034 0.3612431 0.4179860 0.3830279 0.3888446 0.3398733 0.3797251
#> [8] 0.4241814 0.3924223 0.4009581 0.3386207 0.3844423 0.3646142 0.3103187
#> [15] 0.2239479 0.3692034 0.4088924 0.2859181 0.3998623 0.4061258 0.4590591
#> [22] 0.5713697 0.4576071 0.5388694 0.4618255 0.3771409 0.4253512 0.4496424
#> [29] 0.3680105 0.3176516 0.3588777 0.3836673 0.3477051 0.3232797 0.3258889
#> [36] 0.3079632 0.2453025 0.2813640 0.3614430 0.3759858 0.4338411 0.3798846
#> [43] 0.2938054 0.3406377 0.3946273 0.3996411 0.4421544 0.4511584 0.4627840
#> [50] 0.4643824 0.4965061 0.4851126 0.5488315 0.5162410 0.4874223 0.4486016
#> [57] 0.4750617 0.3574412 0.3075806 0.3295135 0.2733143 0.1929950 0.2471847
#> [64] 0.2575473 0.3102890 0.4253364 0.4207629 0.3427158 0.4134833 0.4168334
#> [71] 0.4456964 0.4151854 0.3722371 0.3971003 0.4620173 0.4580512 0.3318005
#> [78] 0.3040386 0.2342411 0.2705456 0.2990085 0.3302426 0.3900553 0.3766262
#> [85] 0.3907007 0.4206139 0.4429881 0.4925287 0.4756075 0.4970323 0.4606768
#> [92] 0.4724840 0.3956490 0.5196185 0.5172512 0.4928490 0.2974632 0.3007917
#> [99] 0.3490870 0.3658712 0.3107833 0.4164873 0.3613287 0.3619648 0.4301881
#> [106] 0.4821166 0.4074124 0.4741268 0.4103014 0.3574101 0.3582676 0.4227797
#> [113] 0.4464350 0.3788471 0.4234292 0.4082693 0.4136828 0.4435125 0.4266706
#> [120] 0.5029988 0.4750601 0.4508721 0.5205573 0.4920684 0.4830824 0.5205294
#> [127] 0.4496992 0.4855174 0.3592998 0.2941172 0.3968978 0.4779726 0.5075846
#> [134] 0.5267767 0.5004980 0.4680125 0.3239376 0.2967093 0.3862368 0.5095818
#> [141] 0.4849484 0.4450604 0.3800559 0.3551307 0.3680536 0.3749978 0.3607942
#> [148] 0.3568244 0.5113439 0.4262529 0.3134967 0.3652773 0.4145645 0.4315221
#> [155] 0.4097411 0.5255043 0.3942359 0.3999910 0.4493664 0.4680060 0.5265723
#> [162] 0.6228875 0.2950965 0.4573576 0.4811837 0.3732733 0.3352019 0.4335920
#> [169] 0.4098011 0.3197201 0.4510762 0.4037698 0.4828151 0.4653346 0.4535062
#> [176] 0.4484488 0.4575518 0.4516795 0.4435347 0.4716252 0.5417148 0.5344356
#> [183] 0.4567528 0.3411291 0.3664537 0.4150806 0.5076936 0.5405238 0.6347667
#> [190] 0.6668688 0.6761183 0.5609940 0.6724047 0.5717815 0.4367208 0.4231655
#> [197] 0.3931543 0.4630435 0.4082050 0.3921360 0.4131521 0.4287876 0.5051901
#> [204] 0.5077451 0.4102495 0.5287606 0.6128477 0.6335997 0.6579703 0.5542942
#> [211] 0.5305798 0.5680142 0.5468653 0.6351385 0.5431000 0.3788500 0.3438827
#> [218] 0.3431914 0.3071715 0.4160355 0.5022189 0.5216497 0.4896014 0.4969007
#> [225] 0.4944184 0.4010607 0.4466588 0.3866575 0.3123721 0.2726508 0.3534351
#> [232] 0.3440758 0.4634056 0.4176112 0.4593174 0.3915845 0.4737337 0.4444284
#> [239] 0.3898918 0.3239986 0.3262805 0.2440534 0.2498692 0.4010374 0.2695430
#> [246] 0.3371171 0.3819303 0.3494533 0.3317882 0.3561309 0.3996947 0.4881493
#> [253] 0.4916436 0.4281350 0.4160944 0.3818898 0.3420647 0.4437572 0.4034327
#> [260] 0.3676096 0.4087840 0.4230717 0.3952509 0.4019765 0.4924921 0.5250713
#> [267] 0.4563321 0.4099172 0.4860270 0.6142802 0.4943097 0.4106163 0.2919803
#> [274] 0.4336972 0.4562082 0.4558593 0.4030492 0.3928996 0.3337134 0.3736967
#> [281] 0.3906059 0.4375773 0.3543904 0.4629457 0.4286942 0.4124811 0.5612441
#> [288] 0.5037031 0.5032383 0.4763066 0.5693377 0.5561478 0.5786330 0.5273299
#> [295] 0.4951378 0.4422003 0.3779430 0.3200041 0.3120243 0.2814509 0.3246990
#> [302] 0.3636596 0.3589129 0.3767921 0.3113951 0.3945056 0.4038430 0.4514205
#> [309] 0.4644253 0.4994040 0.4413605 0.4081287 0.3768486 0.4008377 0.3770124
#> [316] 0.3628785 0.3616416 0.3313288 0.2734174 0.2363448 0.3643890 0.2783298
#> [323] 0.5022343 0.4899900 0.4248330 0.4398167 0.5174453 0.4242429 0.3429054
#> [330] 0.4523458 0.4521852 0.5538871 0.4664953 0.4089807 0.4425488 0.4533230
#> [337] 0.5084943 0.6247199 0.5699033 0.4626674 0.4465088 0.4344467 0.3826317
#> [344] 0.3842354 0.3215803 0.3833928 0.3468475 0.3612668 0.3665713 0.3497570
#> [351] 0.3135482 0.2612079 0.2046156 0.2834653 0.3981412 0.4631618 0.4588787
#> [358] 0.4064763 0.4105782 0.4157472 0.5156038 0.5149637 0.4905699 0.4776615
#> [365] 0.4054333 0.3596380 0.3691968 0.3575635 0.3752148 0.3689560 0.1418785
#> [372] 0.1584341 0.1988403 0.2713303 0.4349273 0.4282067 0.4636576 0.4405378
#> [379] 0.4763595 0.3711578 0.3980229 0.2634688 0.2886687 0.3687519 0.3396307
#> [386] 0.4134015 0.4130528 0.4107633 0.4317901 0.4319814 0.4342814 0.4058709
#> [393] 0.3845170 0.3696712 0.3669426 0.3485255 0.4795397 0.4736301 0.4878738
#> [400] 0.4200137 0.4021133 0.4810702 0.4812588 0.3835008 0.3728373 0.3862609
#> [407] 0.3841817 0.4826022 0.5970803 0.4714583 0.4446080 0.3701863 0.3533619
#> [414] 0.4603389 0.4431939 0.4366614 0.4205732 0.3561068 0.4142464 0.3719803
#> [421] 0.4233862 0.3742252 0.4476472 0.4290592 0.4243382 0.4370228 0.3802081
#> [428] 0.3816765 0.3492634 0.4201010 0.5010877 0.5729314 0.4851824 0.3719554
#> [435] 0.2185459 0.1773797 0.2895272 0.3814877 0.4888928 0.4333452 0.2901139
#> [442] 0.4053035 0.4289929 0.3605146 0.4107097 0.3724540 0.2881791 0.3884011
#> [449] 0.4509262 0.4318705 0.3191597 0.3125005 0.3639109 0.3179818 0.2958831
#> [456] 0.3429347 0.3176721 0.3404349 0.2999163 0.3344136 0.4036797 0.4131358
#> [463] 0.4526878 0.5250622 0.5510277 0.5361223 0.5377100 0.4596622 0.4373413
#> [470] 0.4857924 0.4211132 0.4385802 0.4372460 0.5197671 0.4459800 0.4939278
#> [477] 0.4599087 0.4789507 0.5087485 0.4819717 0.5207612 0.5217648 0.5418603
#> [484] 0.5190519 0.4147724 0.4985190 0.4058844 0.3387136 0.3274125 0.3778674
#> [491] 0.3627314 0.3638444 0.3467047 0.3486959 0.4883465 0.4690357 0.3530341
#> [498] 0.3351977 0.3497655 0.4344103