
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.4481617 0.3998980 0.3976890 0.4511473 0.3953472 0.4326672 0.3415187
#> [8] 0.4584170 0.3965729 0.3416487 0.4060912 0.4812362 0.5291457 0.6038360
#> [15] 0.6908918 0.6160358 0.5806054 0.5615706 0.5153869 0.3904553 0.3126957
#> [22] 0.3212757 0.2866798 0.2576410 0.2101200 0.3402015 0.4122309 0.3174094
#> [29] 0.3238958 0.3619147 0.4148555 0.3335764 0.3435000 0.3790480 0.3730020
#> [36] 0.3249355 0.3868723 0.4642318 0.4214535 0.3793982 0.3813112 0.3323902
#> [43] 0.3583456 0.3846833 0.4425129 0.3655983 0.3593681 0.3924327 0.3755018
#> [50] 0.3409930 0.3573254 0.3489736 0.2766653 0.3545853 0.3512467 0.3004626
#> [57] 0.2923307 0.2556022 0.1966652 0.3386444 0.4514785 0.4622988 0.5927378
#> [64] 0.5629133 0.5676425 0.5003590 0.4137963 0.5116270 0.6008594 0.4678794
#> [71] 0.4208899 0.4252819 0.3724419 0.3251608 0.2709716 0.3588464 0.3282947
#> [78] 0.3649530 0.3885965 0.4498989 0.4240977 0.4532678 0.6185184 0.4713291
#> [85] 0.4676237 0.4453793 0.4031963 0.2688764 0.2906054 0.3977375 0.2524703
#> [92] 0.1947867 0.2408039 0.3610560 0.3490191 0.3133879 0.4036944 0.3595035
#> [99] 0.3780484 0.3495478 0.3815852 0.3807532 0.4464071 0.4508177 0.5187211
#> [106] 0.4038820 0.4151334 0.4828501 0.5849998 0.5696505 0.4613799 0.4996473
#> [113] 0.4382276 0.5466990 0.5346318 0.4973827 0.4177479 0.4884286 0.5676326
#> [120] 0.4786620 0.4986536 0.4697274 0.4205745 0.2785103 0.2174807 0.2458126
#> [127] 0.2281447 0.4269461 0.4150831 0.4246147 0.4037600 0.4283682 0.4540083
#> [134] 0.5006120 0.5427689 0.5283263 0.5901764 0.4262956 0.4092658 0.3560077
#> [141] 0.3255229 0.3157147 0.4074640 0.3224055 0.3066891 0.3708487 0.3865652
#> [148] 0.3725170 0.3704962 0.3474377 0.3391727 0.3906858 0.3748045 0.3733684
#> [155] 0.2913998 0.3483370 0.3173965 0.2732964 0.2063079 0.2744750 0.2892975
#> [162] 0.4107903 0.4703351 0.4645336 0.4733197 0.4110738 0.4409579 0.4434912
#> [169] 0.4554125 0.4110460 0.3606130 0.3705079 0.3998916 0.3065186 0.3441992
#> [176] 0.3576028 0.4020100 0.3912273 0.3794575 0.4079847 0.3928590 0.4577791
#> [183] 0.4592539 0.3520003 0.5026022 0.4494576 0.2648101 0.1977540 0.3749693
#> [190] 0.2796172 0.3399464 0.3535661 0.3834086 0.3966076 0.4543692 0.4618887
#> [197] 0.4674005 0.4884018 0.4983614 0.4251324 0.3606855 0.4233748 0.3582803
#> [204] 0.3680719 0.5056443 0.4671442 0.5310789 0.4411025 0.4922178 0.4904029
#> [211] 0.4525815 0.4078549 0.2189997 0.3411075 0.2678978 0.1867691 0.3306392
#> [218] 0.5138396 0.5847524 0.4556992 0.4557053 0.4460786 0.4197267 0.4038126
#> [225] 0.4283292 0.4929944 0.4552912 0.4125726 0.4251224 0.3975269 0.4225134
#> [232] 0.4678682 0.4952680 0.4587323 0.5640943 0.6126593 0.4512356 0.4330371
#> [239] 0.4254669 0.4168356 0.4241714 0.4994462 0.4143006 0.4705575 0.3638797
#> [246] 0.3651190 0.2986341 0.4227790 0.4281886 0.4779935 0.5081228 0.4340305
#> [253] 0.4288990 0.4152523 0.2876295 0.4404832 0.5752677 0.6101029 0.5269204
#> [260] 0.4581167 0.5476195 0.5156160 0.6538018 0.5265556 0.5668689 0.5017350
#> [267] 0.4387637 0.5272714 0.6015277 0.5302373 0.5302491 0.5721755 0.5680125
#> [274] 0.6194426 0.6077612 0.5193859 0.4160783 0.5069417 0.4498273 0.5336908
#> [281] 0.5629379 0.5193708 0.3617073 0.2310374 0.1211640 0.1245137 0.2738719
#> [288] 0.4606801 0.4215926 0.3872000 0.3885273 0.4150083 0.3839396 0.4204987
#> [295] 0.3601573 0.3773066 0.3200850 0.3400583 0.4082534 0.4727206 0.4425038
#> [302] 0.4666174 0.5599113 0.4721395 0.4751616 0.3994226 0.3489807 0.3430259
#> [309] 0.2227035 0.2760211 0.3916763 0.3669691 0.3905221 0.3722418 0.3534337
#> [316] 0.3183973 0.5109661 0.4992309 0.5675037 0.5256177 0.4802482 0.4907616
#> [323] 0.4811211 0.4866917 0.4375769 0.4353447 0.3822695 0.3587820 0.3651188
#> [330] 0.2971057 0.2940714 0.3884280 0.5104404 0.5735380 0.7022971 0.5476402
#> [337] 0.4745067 0.4746723 0.4364695 0.5093466 0.4967442 0.4026109 0.3460939
#> [344] 0.3277210 0.3247052 0.2290870 0.3059455 0.3383725 0.5183198 0.4839621
#> [351] 0.4393418 0.4344057 0.4293919 0.4436932 0.4862980 0.4543754 0.3787629
#> [358] 0.4121214 0.4327266 0.3729076 0.3220906 0.3445700 0.3198623 0.3204337
#> [365] 0.3465820 0.4030545 0.4704145 0.6636815 0.5394200 0.4880813 0.4289289
#> [372] 0.4001720 0.4167380 0.3371668 0.2760016 0.2757099 0.3832860 0.4809477
#> [379] 0.4943105 0.3382521 0.4856439 0.5803950 0.5437801 0.4089384 0.3384515
#> [386] 0.3115460 0.4077833 0.3295058 0.3245946 0.2720520 0.3431654 0.3403924
#> [393] 0.4310542 0.4193594 0.4066992 0.4998037 0.5444119 0.5515060 0.4779716
#> [400] 0.4810934 0.4580118 0.4354919 0.3505483 0.3866776 0.4113452 0.4312804
#> [407] 0.5523537 0.5338644 0.4420931 0.4139571 0.4422173 0.3680640 0.3814855
#> [414] 0.4451915 0.4593826 0.5274962 0.3542563 0.3632393 0.3687171 0.3325074
#> [421] 0.3337531 0.3437569 0.3851290 0.3674728 0.3581291 0.3972232 0.5033025
#> [428] 0.5402077 0.5915018 0.6631005 0.6497154 0.5858192 0.4641967 0.4385804
#> [435] 0.5235622 0.5030162 0.5066648 0.5534947 0.6146661 0.5523907 0.6564210
#> [442] 0.6439589 0.6470600 0.5859266 0.5288230 0.6060370 0.5692549 0.5917387
#> [449] 0.5168841 0.4732712 0.5068249 0.5840497 0.5306581 0.3538596 0.3857524
#> [456] 0.4116420 0.5476318 0.5019796 0.5378336 0.4331287 0.4337526 0.3506033
#> [463] 0.4092295 0.3874112 0.3769832 0.3531760 0.3203082 0.3737214 0.5178889
#> [470] 0.4286452 0.3784521 0.4233699 0.4608464 0.4490222 0.3045462 0.3379820
#> [477] 0.3845071 0.3414247 0.3388044 0.5212192 0.4561970 0.4758382 0.5186508
#> [484] 0.5285986 0.5076621 0.4379378 0.3761757 0.4710357 0.4874578 0.4564739
#> [491] 0.4080734 0.3769394 0.3466857 0.2676064 0.2823117 0.3529697 0.3663845
#> [498] 0.3771268 0.4403482 0.3375749