
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.3589957 0.4769831 0.4463764 0.3927224 0.3071614 0.2938276 0.3369984
#> [8] 0.3687370 0.3848734 0.3547043 0.4964302 0.4629004 0.5028910 0.5125875
#> [15] 0.4781892 0.4541014 0.5589975 0.5502245 0.6768425 0.6604227 0.6360558
#> [22] 0.5299132 0.5572507 0.5166811 0.4165749 0.3301761 0.2991219 0.4418726
#> [29] 0.4820466 0.4918208 0.5320216 0.6477431 0.7352318 0.5613581 0.4453855
#> [36] 0.5076330 0.4602907 0.4097512 0.4053851 0.4058788 0.4133835 0.3253281
#> [43] 0.3243735 0.3497812 0.3547659 0.4109231 0.3936041 0.2854252 0.2704622
#> [50] 0.3426643 0.3732646 0.4052496 0.3778524 0.3899405 0.3604837 0.3587953
#> [57] 0.3985290 0.4158691 0.4171893 0.4012784 0.4908508 0.5632968 0.4629104
#> [64] 0.4245970 0.5949380 0.6310410 0.6093956 0.6237678 0.6157508 0.5945987
#> [71] 0.5711169 0.5430280 0.5673750 0.5217293 0.4912412 0.5021453 0.4821166
#> [78] 0.5740941 0.5906353 0.6259682 0.5118487 0.4662915 0.3837873 0.4795074
#> [85] 0.3946135 0.3706843 0.3831240 0.3720566 0.5000261 0.3315614 0.4739219
#> [92] 0.3930591 0.3426010 0.2840941 0.3396766 0.3285375 0.4028214 0.4334626
#> [99] 0.4325091 0.3841770 0.4433598 0.5024134 0.4454363 0.3947329 0.3753156
#> [106] 0.4269988 0.4901916 0.4550260 0.4097023 0.5494637 0.6224847 0.7453210
#> [113] 0.5847878 0.5116186 0.4697399 0.4298494 0.5442207 0.4341509 0.3504619
#> [120] 0.3536707 0.4188212 0.4148456 0.3622475 0.3158304 0.3467909 0.3365734
#> [127] 0.3954879 0.4571953 0.3291884 0.4071337 0.4905912 0.5417463 0.3622566
#> [134] 0.4634819 0.5008126 0.5541967 0.4795046 0.4911394 0.4974224 0.5090958
#> [141] 0.4575643 0.4771919 0.4780885 0.5296324 0.4146728 0.4585821 0.4232922
#> [148] 0.4469244 0.4710204 0.4985109 0.4445162 0.3855865 0.3759009 0.3774453
#> [155] 0.3394486 0.3539921 0.3685803 0.3559808 0.3695474 0.3613475 0.3645479
#> [162] 0.3687657 0.4704076 0.4018021 0.3188221 0.4147664 0.3303119 0.2801166
#> [169] 0.4301745 0.5452271 0.5419400 0.5973018 0.4814531 0.6514730 0.6453640
#> [176] 0.6159294 0.5754552 0.5591416 0.5143461 0.4314061 0.4344657 0.4134173
#> [183] 0.4171722 0.3395438 0.2779156 0.3535871 0.3881974 0.4364692 0.3632499
#> [190] 0.4288015 0.3942885 0.3785454 0.4274624 0.4309375 0.4086653 0.4073031
#> [197] 0.4606647 0.3639556 0.3839498 0.3352689 0.4010415 0.4823871 0.4704161
#> [204] 0.5128695 0.4585084 0.5180202 0.2947393 0.3546827 0.5003808 0.4933323
#> [211] 0.5010977 0.4196869 0.5010533 0.5067064 0.4654104 0.4542874 0.3331046
#> [218] 0.5113099 0.4933108 0.4012710 0.4598357 0.4937376 0.4505469 0.5617168
#> [225] 0.5040643 0.5014189 0.4720411 0.5237669 0.4683105 0.3870816 0.3604364
#> [232] 0.4575510 0.4747346 0.4742863 0.4960545 0.4971168 0.4790450 0.4449934
#> [239] 0.4112721 0.4206530 0.4792761 0.5389253 0.5430647 0.4918581 0.4994891
#> [246] 0.4274694 0.3797399 0.2738276 0.3376346 0.4054420 0.3329796 0.4074916
#> [253] 0.5114491 0.5031008 0.5876967 0.4516726 0.6216976 0.5986951 0.5046430
#> [260] 0.4548923 0.4394543 0.3826244 0.3844364 0.4480755 0.4537583 0.5045473
#> [267] 0.5786852 0.4349614 0.3894818 0.4470299 0.4119500 0.5040884 0.5395926
#> [274] 0.4902487 0.3724175 0.3833518 0.4521445 0.4203445 0.4016583 0.4109692
#> [281] 0.4696024 0.4734822 0.4984955 0.4957585 0.4495087 0.3573541 0.3624857
#> [288] 0.3363547 0.4291894 0.4272383 0.4149170 0.4030611 0.4084815 0.4184472
#> [295] 0.4420362 0.4193924 0.4236795 0.3714680 0.4516267 0.5109401 0.5238270
#> [302] 0.4706056 0.4265252 0.4042185 0.3978568 0.3855122 0.4050536 0.4256554
#> [309] 0.4147641 0.3398152 0.3829192 0.3484575 0.3015561 0.3953738 0.3887994
#> [316] 0.2402098 0.3944903 0.3415916 0.3193965 0.3957560 0.3004790 0.3917886
#> [323] 0.3467032 0.4429037 0.4457404 0.5190097 0.4791683 0.4678621 0.6473307
#> [330] 0.6579510 0.5946304 0.5384727 0.3537256 0.2741718 0.3463905 0.3787063
#> [337] 0.3842412 0.2156192 0.2258973 0.2656093 0.2717148 0.2827764 0.3326403
#> [344] 0.4525544 0.5152989 0.5908170 0.5576780 0.5870023 0.4928441 0.4465471
#> [351] 0.3740697 0.3950097 0.3983469 0.3742666 0.3797649 0.3857303 0.3726366
#> [358] 0.3291229 0.3962263 0.4928689 0.4283551 0.4811622 0.4102284 0.4686710
#> [365] 0.5312122 0.4684278 0.5464552 0.5486517 0.5361090 0.4904709 0.3941482
#> [372] 0.3747895 0.4527868 0.4599034 0.4450916 0.3408257 0.3996015 0.4059107
#> [379] 0.5295674 0.6181632 0.5288385 0.6035093 0.5530484 0.5624018 0.5621106
#> [386] 0.4592867 0.3939238 0.3907607 0.3418709 0.3204397 0.3478838 0.2930413
#> [393] 0.2715174 0.3324932 0.3347659 0.3999490 0.3855605 0.3877067 0.3068739
#> [400] 0.2610862 0.2231876 0.2495332 0.3150899 0.3692108 0.3847396 0.4416459
#> [407] 0.3838721 0.4312885 0.5673946 0.6014042 0.5253730 0.3859228 0.3994758
#> [414] 0.4643201 0.5183780 0.5371728 0.6165260 0.5683456 0.4943543 0.4752173
#> [421] 0.4642619 0.3984795 0.3384534 0.3395304 0.3031137 0.2891886 0.2241811
#> [428] 0.2984375 0.3025530 0.3294340 0.3533708 0.4495033 0.4717010 0.4065620
#> [435] 0.4545086 0.4285976 0.4778979 0.4455068 0.4817095 0.5755923 0.4128953
#> [442] 0.4489758 0.4443186 0.4256035 0.3755386 0.4244887 0.4171113 0.3970206
#> [449] 0.4141572 0.4215108 0.3890213 0.4273360 0.4104965 0.4588358 0.3868756
#> [456] 0.4202012 0.4929606 0.4740402 0.4166416 0.4825300 0.5501658 0.5569132
#> [463] 0.4711958 0.5696408 0.4401403 0.4176002 0.4426277 0.4802978 0.4337822
#> [470] 0.4040020 0.3961120 0.4098882 0.5374109 0.5947614 0.4005262 0.4273846
#> [477] 0.5037715 0.4813616 0.4059366 0.3868525 0.3916565 0.3581364 0.3506548
#> [484] 0.3691011 0.3466736 0.4557609 0.4860155 0.4029493 0.4981520 0.4119964
#> [491] 0.4294704 0.4156890 0.3738541 0.4750283 0.5117767 0.5491134 0.5595851
#> [498] 0.5878527 0.4961805 0.5724047