
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.4444991 0.4815934 0.5261710 0.6180395 0.4573281 0.3996644 0.3652543
#> [8] 0.3564051 0.3122122 0.4312236 0.4350491 0.4608106 0.4350906 0.4067487
#> [15] 0.2320916 0.1886620 0.2878306 0.4424359 0.4281865 0.3550208 0.3140547
#> [22] 0.3284258 0.4000225 0.4070211 0.4023499 0.4635652 0.4840517 0.6278811
#> [29] 0.5503941 0.3648658 0.4094440 0.3584942 0.3730581 0.3453278 0.2628329
#> [36] 0.2554324 0.3925389 0.2920077 0.3548640 0.5149091 0.5515732 0.4818439
#> [43] 0.3999481 0.3076737 0.2082807 0.3701933 0.4186337 0.3784499 0.3403104
#> [50] 0.2705282 0.3945072 0.4509989 0.3903139 0.4908043 0.5169725 0.4221291
#> [57] 0.4356355 0.4911983 0.4498246 0.4826695 0.5530469 0.4068218 0.3405269
#> [64] 0.3920026 0.3376433 0.2925596 0.2471292 0.3156504 0.2626452 0.2556088
#> [71] 0.4352609 0.4488132 0.4204689 0.3787869 0.3561483 0.2811309 0.2774889
#> [78] 0.2475298 0.3421632 0.4442405 0.4142194 0.3772913 0.3909775 0.4505537
#> [85] 0.4621333 0.4694094 0.4783865 0.5105861 0.4511514 0.5056134 0.5378099
#> [92] 0.6306835 0.5484073 0.4502752 0.3205997 0.2483194 0.2532478 0.2194597
#> [99] 0.2611428 0.2692123 0.4184968 0.3607529 0.3753591 0.4017277 0.3928280
#> [106] 0.4829961 0.5764130 0.4932365 0.4618861 0.5384700 0.5765327 0.5750090
#> [113] 0.5610718 0.4758457 0.4476269 0.3765807 0.3998207 0.4372618 0.4328889
#> [120] 0.4612268 0.4050231 0.4556164 0.3364492 0.3474943 0.2736138 0.3393461
#> [127] 0.3102943 0.3265529 0.3506345 0.3576253 0.3981572 0.3294426 0.3790399
#> [134] 0.4244371 0.4897886 0.4556532 0.5167822 0.4294011 0.5502255 0.6338054
#> [141] 0.6109700 0.5689015 0.5715027 0.5809424 0.5691196 0.4951706 0.4205629
#> [148] 0.4201017 0.3659929 0.3949087 0.4726879 0.4082457 0.4312611 0.5483614
#> [155] 0.4396698 0.4357831 0.4819934 0.4994647 0.4200953 0.3912055 0.4054454
#> [162] 0.2490211 0.4191447 0.4265730 0.4698466 0.4593108 0.5420406 0.4335610
#> [169] 0.4049189 0.3182610 0.4023431 0.3653975 0.3808855 0.2805451 0.2892922
#> [176] 0.4423105 0.4888232 0.3985070 0.3718306 0.5085453 0.4549761 0.5456120
#> [183] 0.5084953 0.5515173 0.4902181 0.5082593 0.4861380 0.4101019 0.3719847
#> [190] 0.3244657 0.2664457 0.3388571 0.3808763 0.3986252 0.4238907 0.4238781
#> [197] 0.5016766 0.5078446 0.4733414 0.5188540 0.3289689 0.2057492 0.4463372
#> [204] 0.4485217 0.4744599 0.4701058 0.4729097 0.4534244 0.4258486 0.4592098
#> [211] 0.3391532 0.3595545 0.4412945 0.4284343 0.4027300 0.5615397 0.6288070
#> [218] 0.6025389 0.5323378 0.5515944 0.4695997 0.3474873 0.4180783 0.3911983
#> [225] 0.3939739 0.4275676 0.3193258 0.4067418 0.5085885 0.5529224 0.5503758
#> [232] 0.3415911 0.3913889 0.3455183 0.2473707 0.2653075 0.3614701 0.3389337
#> [239] 0.3210886 0.3743988 0.3272105 0.2713384 0.3166945 0.4419806 0.4792886
#> [246] 0.5017346 0.4586997 0.3920227 0.4609142 0.4933040 0.5275805 0.4912002
#> [253] 0.3449168 0.4362477 0.4224446 0.3441425 0.3760877 0.3629368 0.4728704
#> [260] 0.4432978 0.3830211 0.3927180 0.3742675 0.4466103 0.2951127 0.4339800
#> [267] 0.4922636 0.3992299 0.4114833 0.4170297 0.4308365 0.3969109 0.4371857
#> [274] 0.4424668 0.4955912 0.5851636 0.6357925 0.6731333 0.5680462 0.4754591
#> [281] 0.4966958 0.4264899 0.3029387 0.4054974 0.4038296 0.4515300 0.4172683
#> [288] 0.3851357 0.3519401 0.3874071 0.3673003 0.4372544 0.4605002 0.4979107
#> [295] 0.4042167 0.3786446 0.3752694 0.5542026 0.4764441 0.4318586 0.4328993
#> [302] 0.4043973 0.4164066 0.4034067 0.4388255 0.3944035 0.4333816 0.3692525
#> [309] 0.3207774 0.2164850 0.2945643 0.2975884 0.3410157 0.3774203 0.3880221
#> [316] 0.4196010 0.4599464 0.4616510 0.4839731 0.4955049 0.5654328 0.6495353
#> [323] 0.5816648 0.5179770 0.3732158 0.2964413 0.3831788 0.4753695 0.4473779
#> [330] 0.3450788 0.3996364 0.4383057 0.4142178 0.4333756 0.3277145 0.3677686
#> [337] 0.4625881 0.4686085 0.4673529 0.3999577 0.4321194 0.4014917 0.4442879
#> [344] 0.4060556 0.5501059 0.5608634 0.4993586 0.5839675 0.6109749 0.6081887
#> [351] 0.6946646 0.6206727 0.4057221 0.3903278 0.4801326 0.5113430 0.5567611
#> [358] 0.4840819 0.5025234 0.5422240 0.4669461 0.3830791 0.4719034 0.3004591
#> [365] 0.3618834 0.3674493 0.4359473 0.5186992 0.4730409 0.4442719 0.3338629
#> [372] 0.3132915 0.5040700 0.6106689 0.4505673 0.4089313 0.3509536 0.3796517
#> [379] 0.4090049 0.3571658 0.4132644 0.5011315 0.3696774 0.3088000 0.3469969
#> [386] 0.3554046 0.5749418 0.5385588 0.5668953 0.5121918 0.5112419 0.5283195
#> [393] 0.5119535 0.4075362 0.3383657 0.3450512 0.3066396 0.2659733 0.3843978
#> [400] 0.4885855 0.5208967 0.5480281 0.5234044 0.6297375 0.4904002 0.5127475
#> [407] 0.5666010 0.6281335 0.5431858 0.4585540 0.4211762 0.4306506 0.4118928
#> [414] 0.4052359 0.3589766 0.3686715 0.3647877 0.3767145 0.3802145 0.3637013
#> [421] 0.3390959 0.3729339 0.3214431 0.2858315 0.2706088 0.3119331 0.3328536
#> [428] 0.3546211 0.3926214 0.4172293 0.3732584 0.3231747 0.2575348 0.2389651
#> [435] 0.4641426 0.5288159 0.5362685 0.5147620 0.4806104 0.4373811 0.3765293
#> [442] 0.3388193 0.3357666 0.4575562 0.4949926 0.4464648 0.5181046 0.5730080
#> [449] 0.3748813 0.3752040 0.3429396 0.3477518 0.3359539 0.2889073 0.3680007
#> [456] 0.3232814 0.4146684 0.5022040 0.5500253 0.4446990 0.4899816 0.5016745
#> [463] 0.5361754 0.6139690 0.5729270 0.5435893 0.5253903 0.5287689 0.4460981
#> [470] 0.4688460 0.4309692 0.3901162 0.3774455 0.3883196 0.3421138 0.2783907
#> [477] 0.3623187 0.3202356 0.3725874 0.4311156 0.3693502 0.4394663 0.4110492
#> [484] 0.4627064 0.4724748 0.4622528 0.5094969 0.4689482 0.4507093 0.3953568
#> [491] 0.4288002 0.4521827 0.4529863 0.4410743 0.3731481 0.4825278 0.5067421
#> [498] 0.4902026 0.4287664 0.4213325