
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.
Functions
biomarker(xLevel = integer, model = DualEndpoint, samples = Samples): Extract biomarker values for aDualEndpointmodel.
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.4467947 0.4244849 0.4665428 0.4144117 0.4739668 0.4663904 0.4133993
#> [8] 0.4349626 0.4143305 0.3126293 0.4126773 0.4933272 0.5237807 0.5698133
#> [15] 0.6087964 0.5284276 0.5161891 0.4678487 0.5667175 0.4831100 0.3605381
#> [22] 0.3416229 0.3860916 0.3708601 0.3329532 0.4550421 0.5255903 0.4980816
#> [29] 0.4527290 0.4954734 0.4365782 0.4691345 0.6171911 0.7073728 0.6910979
#> [36] 0.5976652 0.6010360 0.4763994 0.5344011 0.4240525 0.4166627 0.3381549
#> [43] 0.2941440 0.3182660 0.3065590 0.4264835 0.3584866 0.4574166 0.4518773
#> [50] 0.4729804 0.4314691 0.4403280 0.4732812 0.4111854 0.4690940 0.3629836
#> [57] 0.3493034 0.3523138 0.4046437 0.3200369 0.3243031 0.3299724 0.2788026
#> [64] 0.4699282 0.5782684 0.6239648 0.5316577 0.4142925 0.3566388 0.2277845
#> [71] 0.2606184 0.2891162 0.3389188 0.4276894 0.3679324 0.4761092 0.4979008
#> [78] 0.4483790 0.3654400 0.4389564 0.4806876 0.4634120 0.4723500 0.5200041
#> [85] 0.4217462 0.5529156 0.5761159 0.5791705 0.6022158 0.5463405 0.4376544
#> [92] 0.4003307 0.3213454 0.4658987 0.4123444 0.4443323 0.3016392 0.3994763
#> [99] 0.3668441 0.2560481 0.3482285 0.4229345 0.4304208 0.4730412 0.3480165
#> [106] 0.3354408 0.3485758 0.4229751 0.3086185 0.3943094 0.4630471 0.4982211
#> [113] 0.5018310 0.4087123 0.4544576 0.4688829 0.4651707 0.4250910 0.3287468
#> [120] 0.2069700 0.2654803 0.3363893 0.3931402 0.4747353 0.4487260 0.5335877
#> [127] 0.4413321 0.3353375 0.3597751 0.2152810 0.2761153 0.2509331 0.3573436
#> [134] 0.3671531 0.4215761 0.4184776 0.4162169 0.4731605 0.4999066 0.4224978
#> [141] 0.4182814 0.3468784 0.3466861 0.3624329 0.2855296 0.2216411 0.2257967
#> [148] 0.2591541 0.3468135 0.3486025 0.3616530 0.3604749 0.3485503 0.3504589
#> [155] 0.3670610 0.5345630 0.6360503 0.5028541 0.5163686 0.4784383 0.4786398
#> [162] 0.5068003 0.4370137 0.3835017 0.4403843 0.4989858 0.3189616 0.3483433
#> [169] 0.3584762 0.3193905 0.3130176 0.3880310 0.3978185 0.4432764 0.5281635
#> [176] 0.6135108 0.4392724 0.4336354 0.4655150 0.5027587 0.4443358 0.3513996
#> [183] 0.4128439 0.4071059 0.4252414 0.3838222 0.4431424 0.4067375 0.4226216
#> [190] 0.5135991 0.5464250 0.5063616 0.3868190 0.5290521 0.4351567 0.3721659
#> [197] 0.3011170 0.4243931 0.4041485 0.4865615 0.5064850 0.4363182 0.4561735
#> [204] 0.5140196 0.5947432 0.5398084 0.3963917 0.4510900 0.4004985 0.4094191
#> [211] 0.2577298 0.4117439 0.2794499 0.3137140 0.4008172 0.4412439 0.4539516
#> [218] 0.4408957 0.3660420 0.4934853 0.4215108 0.2988679 0.3581920 0.3318795
#> [225] 0.3197300 0.3540761 0.4863500 0.5021100 0.6661512 0.7220467 0.6047813
#> [232] 0.5644031 0.6340684 0.6792233 0.5072382 0.4144333 0.3754677 0.3995774
#> [239] 0.3137559 0.2562294 0.2497426 0.2310485 0.2811639 0.3902948 0.5057574
#> [246] 0.6569827 0.6907143 0.6594175 0.5248773 0.4227245 0.4467534 0.4388404
#> [253] 0.3001463 0.2652787 0.3577928 0.3683103 0.3003665 0.3408674 0.3521398
#> [260] 0.3973836 0.3502014 0.4209018 0.3766967 0.3495589 0.3309458 0.4317265
#> [267] 0.4333716 0.4885241 0.4848540 0.4988546 0.4326031 0.4205228 0.3882495
#> [274] 0.3477087 0.3019145 0.3711455 0.3369098 0.3509675 0.3493510 0.3799661
#> [281] 0.3925170 0.3857210 0.4993245 0.3865950 0.3987083 0.4896515 0.5365727
#> [288] 0.4464732 0.3656669 0.4226980 0.4464381 0.4936412 0.4471580 0.3920451
#> [295] 0.4643654 0.3674130 0.2730320 0.4007613 0.3389543 0.3056574 0.2914520
#> [302] 0.2531071 0.2702908 0.4209710 0.3133102 0.2289362 0.2973224 0.3614950
#> [309] 0.3431370 0.3374960 0.3175237 0.4472865 0.3771345 0.3529565 0.3172772
#> [316] 0.4041155 0.4181110 0.4257399 0.4730343 0.4649994 0.5223641 0.5406325
#> [323] 0.4842984 0.5483009 0.4159357 0.4618543 0.4125337 0.4290434 0.5656773
#> [330] 0.5406034 0.4798041 0.5090306 0.4416145 0.4545832 0.4620183 0.5116185
#> [337] 0.4337203 0.3774553 0.4589307 0.4066853 0.3989124 0.5293485 0.5748561
#> [344] 0.5086952 0.5486736 0.4964683 0.4314420 0.3569302 0.3535198 0.3499873
#> [351] 0.3505164 0.2769993 0.2949685 0.3359988 0.3420603 0.3814329 0.4157478
#> [358] 0.4027860 0.3407378 0.4711831 0.5051468 0.4316814 0.5063435 0.4940600
#> [365] 0.3867400 0.2939495 0.4590566 0.2930835 0.3828703 0.5707420 0.5382693
#> [372] 0.4335315 0.3027924 0.2580255 0.2378846 0.4309288 0.3727748 0.3650574
#> [379] 0.3033495 0.3900474 0.4509172 0.4014362 0.4453105 0.5055011 0.4481292
#> [386] 0.5343351 0.4936626 0.4934246 0.5056776 0.4415931 0.6444669 0.5027844
#> [393] 0.3110651 0.3345228 0.2839946 0.4243967 0.4116309 0.4249958 0.4779643
#> [400] 0.4367438 0.4704582 0.4034668 0.4497673 0.5224594 0.5827398 0.5402530
#> [407] 0.5164020 0.4488761 0.3830046 0.3783581 0.3424953 0.3418412 0.3053025
#> [414] 0.2725436 0.3614866 0.4288670 0.5035298 0.4702205 0.4897391 0.4741478
#> [421] 0.4872027 0.5680280 0.5765712 0.5808345 0.5586759 0.5286792 0.4746038
#> [428] 0.5121316 0.4779552 0.4658589 0.4862808 0.4493335 0.3751171 0.3631386
#> [435] 0.2220518 0.2656266 0.3420581 0.3733809 0.4595930 0.4880296 0.5289235
#> [442] 0.4822205 0.5348237 0.4683674 0.4163975 0.3684816 0.3113980 0.3121884
#> [449] 0.3634768 0.4402921 0.4995286 0.4974615 0.5027851 0.4653032 0.6662939
#> [456] 0.5666425 0.4326348 0.4202944 0.2732571 0.2489103 0.3530091 0.4766024
#> [463] 0.5119968 0.4649424 0.5265012 0.4990221 0.4889954 0.4219993 0.3842759
#> [470] 0.3717515 0.3273727 0.4146643 0.3637297 0.3345412 0.3384736 0.2588459
#> [477] 0.2082520 0.2099317 0.3482586 0.5117330 0.4495361 0.3190938 0.4063855
#> [484] 0.3933338 0.4658077 0.4719568 0.4903296 0.4234573 0.5194451 0.4925685
#> [491] 0.5184425 0.5311410 0.4776298 0.4765779 0.4199500 0.4542177 0.4572396
#> [498] 0.4578146 0.4497966 0.5044279