
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.4719724 0.3023949 0.5094622 0.4442375 0.4952930 0.5285958 0.5678240
#> [8] 0.5236202 0.4004095 0.3801167 0.3961538 0.4298126 0.4094570 0.3962981
#> [15] 0.4859759 0.5104104 0.6236439 0.4290381 0.5157091 0.5272387 0.4508839
#> [22] 0.3760780 0.4155390 0.3856173 0.3554307 0.4072365 0.3718596 0.3518172
#> [29] 0.3799615 0.4044533 0.3791503 0.2157233 0.3235972 0.3261161 0.3206570
#> [36] 0.3145050 0.2113262 0.2426599 0.2571944 0.2881270 0.2467906 0.3154268
#> [43] 0.3395243 0.3654241 0.4028084 0.3561782 0.3804541 0.4182348 0.4015510
#> [50] 0.3375378 0.3595380 0.4396450 0.4276548 0.3521390 0.3756628 0.4232465
#> [57] 0.4851246 0.5580879 0.6470668 0.5941856 0.6538242 0.6352337 0.4452511
#> [64] 0.4315142 0.3470250 0.3904359 0.3762343 0.3074121 0.4970957 0.4460489
#> [71] 0.4441255 0.4507128 0.3767873 0.4450457 0.4958759 0.4955744 0.5298180
#> [78] 0.6192067 0.7382622 0.5378087 0.3773967 0.2727471 0.2965237 0.3460821
#> [85] 0.3896266 0.4058890 0.4938357 0.5097361 0.5326078 0.4866162 0.3469224
#> [92] 0.4005741 0.4094563 0.5171551 0.4687196 0.3682785 0.5152796 0.4555113
#> [99] 0.4434589 0.4342845 0.4965965 0.4318100 0.4304659 0.4253498 0.3784813
#> [106] 0.4568866 0.4306323 0.4822933 0.3414548 0.2781530 0.2891555 0.3133722
#> [113] 0.2580220 0.2205643 0.2687305 0.3064527 0.3792517 0.4123518 0.3927552
#> [120] 0.4257738 0.3479708 0.4434850 0.4385451 0.3789491 0.3968397 0.3917005
#> [127] 0.3564594 0.3333887 0.3378964 0.2813954 0.2780770 0.3729908 0.4870987
#> [134] 0.4990401 0.4698553 0.4976459 0.5448521 0.5333248 0.4555754 0.3851220
#> [141] 0.4813502 0.4973976 0.5289504 0.5152303 0.5029263 0.5906026 0.5455618
#> [148] 0.4387172 0.3930979 0.3989698 0.4965861 0.4521908 0.5183904 0.4433034
#> [155] 0.4118743 0.5144775 0.5265103 0.5220911 0.4448419 0.4524189 0.5340997
#> [162] 0.4625972 0.4796719 0.4772460 0.4740562 0.4929199 0.5254082 0.5515896
#> [169] 0.5164887 0.5072450 0.4134372 0.4119307 0.3513056 0.3996342 0.2823455
#> [176] 0.2522195 0.3399816 0.3481040 0.4040199 0.4449402 0.2958939 0.3200384
#> [183] 0.4798807 0.4298489 0.4099510 0.5042475 0.5868290 0.5502371 0.4967069
#> [190] 0.5177764 0.4440971 0.4334290 0.4338639 0.3923410 0.4252917 0.4043193
#> [197] 0.4653610 0.4766908 0.5248157 0.4712212 0.4532896 0.4732968 0.4305761
#> [204] 0.4211059 0.4653019 0.5110130 0.4293067 0.4987664 0.4410050 0.4322678
#> [211] 0.4413274 0.3900384 0.3959590 0.3443704 0.3773162 0.3630258 0.4146679
#> [218] 0.3343021 0.2666625 0.4124396 0.5156959 0.6166325 0.6252710 0.5800828
#> [225] 0.5497184 0.4609713 0.3786852 0.3749504 0.3075236 0.3618054 0.3129785
#> [232] 0.3854616 0.4510029 0.3980753 0.4757438 0.3310532 0.3208881 0.2895882
#> [239] 0.3306064 0.3984142 0.3717322 0.4208566 0.3624053 0.3602484 0.3270748
#> [246] 0.3079360 0.4569080 0.3963352 0.2362883 0.2938510 0.3248776 0.3385390
#> [253] 0.3582954 0.3820975 0.4537882 0.5476510 0.4385499 0.3712184 0.4250453
#> [260] 0.3314052 0.3879606 0.2765053 0.3545704 0.3487169 0.4564717 0.4315994
#> [267] 0.4274524 0.3751730 0.4757165 0.5532467 0.5814315 0.5110499 0.5739305
#> [274] 0.5237533 0.4591080 0.4723359 0.4629160 0.3865447 0.2756823 0.3148945
#> [281] 0.3647511 0.4039759 0.4207335 0.3309098 0.4083068 0.4626381 0.5070438
#> [288] 0.4373235 0.4288395 0.3789660 0.3517584 0.2276683 0.1566219 0.2760698
#> [295] 0.2184084 0.2460631 0.2771883 0.3113531 0.3229276 0.2315566 0.2948288
#> [302] 0.3194152 0.4177814 0.3807085 0.4168338 0.3695959 0.4767966 0.5485194
#> [309] 0.4400998 0.3830481 0.4083988 0.3861565 0.4204311 0.3480800 0.4094457
#> [316] 0.4412511 0.4879044 0.4546653 0.4421437 0.4647436 0.4203967 0.4496862
#> [323] 0.5377484 0.4128072 0.4635992 0.4651302 0.4949979 0.5040879 0.3158798
#> [330] 0.3676951 0.2899834 0.4103898 0.2879618 0.2675894 0.2898741 0.2679466
#> [337] 0.2809923 0.3691177 0.5170546 0.5044758 0.5297409 0.5517135 0.6376659
#> [344] 0.6528606 0.5305020 0.5857835 0.5988732 0.4586351 0.5281555 0.6077229
#> [351] 0.5151011 0.3647276 0.1714154 0.1521575 0.2752170 0.2389765 0.3032444
#> [358] 0.2315147 0.2987175 0.2913641 0.3394073 0.4538781 0.4046829 0.4108221
#> [365] 0.4442105 0.4766132 0.6442448 0.5327203 0.6182675 0.4723653 0.4579167
#> [372] 0.5099229 0.5495005 0.4707825 0.6527854 0.5726070 0.3810116 0.5433141
#> [379] 0.6060574 0.6450035 0.6513601 0.5363213 0.5368893 0.4604658 0.4112562
#> [386] 0.3930616 0.3021904 0.4704934 0.3727056 0.4026180 0.4226376 0.4363189
#> [393] 0.4875310 0.5173785 0.5583170 0.6317460 0.6678915 0.6711159 0.6808717
#> [400] 0.6779228 0.4779879 0.5470550 0.4393747 0.4916622 0.5433872 0.5809993
#> [407] 0.7356308 0.5945700 0.7579059 0.6067131 0.4542811 0.4907656 0.4736817
#> [414] 0.3253384 0.3813740 0.2415379 0.2361141 0.2328511 0.2884323 0.2956855
#> [421] 0.3648400 0.4381745 0.4132400 0.5400963 0.5679931 0.4692599 0.4094647
#> [428] 0.3957657 0.3949906 0.2322873 0.3721984 0.4038732 0.3680721 0.3512276
#> [435] 0.2527440 0.2677745 0.2123675 0.2801037 0.2517704 0.3198591 0.4807957
#> [442] 0.4500767 0.5087459 0.5463414 0.5070684 0.4087965 0.4926674 0.4734808
#> [449] 0.4097662 0.4500508 0.4212480 0.4625953 0.5365222 0.5864367 0.7356052
#> [456] 0.6163821 0.5008115 0.3876406 0.4014306 0.3931732 0.3659007 0.4017085
#> [463] 0.3084865 0.3703969 0.4389560 0.3566165 0.4576774 0.3987409 0.4516484
#> [470] 0.5318885 0.5053093 0.5776637 0.6002160 0.6136243 0.6826411 0.4451914
#> [477] 0.1481928 0.3341603 0.2432781 0.2607279 0.4990211 0.4839395 0.5455953
#> [484] 0.4676404 0.3998881 0.2999108 0.3451433 0.2494927 0.2829707 0.2651881
#> [491] 0.3362707 0.3161661 0.3149500 0.3202735 0.4728601 0.4648252 0.4995142
#> [498] 0.4026894 0.4325141 0.4218117