
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.5944429 0.5788633 0.3991701 0.3082573 0.4250454 0.4281282 0.3556325
#> [8] 0.4216397 0.4455697 0.3239936 0.3711304 0.3941215 0.3474051 0.3853549
#> [15] 0.3104812 0.3492523 0.3864223 0.4603285 0.3432547 0.3567260 0.2765147
#> [22] 0.2529796 0.3744064 0.3617973 0.3257332 0.2473517 0.2177915 0.2691646
#> [29] 0.2649278 0.3257057 0.3610371 0.3887602 0.3977397 0.4231360 0.4149497
#> [36] 0.4054310 0.4015205 0.3772847 0.3495565 0.3852619 0.3796042 0.4381903
#> [43] 0.5008095 0.5562270 0.5497463 0.4946304 0.4667023 0.4656179 0.4082196
#> [50] 0.5121060 0.3393569 0.3487459 0.3226150 0.3800448 0.3639028 0.3656937
#> [57] 0.3655668 0.4204458 0.4230435 0.4912620 0.5254514 0.4461587 0.4398928
#> [64] 0.5351755 0.3920035 0.3338659 0.4005262 0.4138820 0.3541494 0.3641566
#> [71] 0.3146438 0.3667365 0.3288530 0.3538248 0.2971646 0.2901193 0.4135109
#> [78] 0.4206852 0.4712127 0.4968006 0.4459646 0.4291627 0.5397259 0.4733085
#> [85] 0.5009104 0.4287042 0.3198936 0.4164561 0.3760869 0.4413314 0.4126802
#> [92] 0.4742282 0.4622392 0.3446961 0.4019709 0.2676614 0.3993870 0.4072174
#> [99] 0.4162726 0.3590640 0.3328533 0.3433976 0.3485478 0.3419070 0.3524183
#> [106] 0.4036800 0.4503236 0.4537266 0.4931938 0.4282906 0.3479121 0.2620802
#> [113] 0.3133713 0.3952709 0.3984949 0.4409524 0.5445724 0.5376074 0.5715756
#> [120] 0.4899256 0.4508103 0.3301466 0.3996350 0.3357306 0.3475365 0.3679638
#> [127] 0.3105503 0.2850722 0.3656772 0.3356914 0.3931824 0.4041632 0.4781895
#> [134] 0.4953564 0.5345824 0.4566526 0.5450109 0.4856251 0.4857816 0.4456423
#> [141] 0.3959357 0.4266431 0.4158490 0.4354894 0.4154488 0.4546496 0.3499892
#> [148] 0.2749325 0.2944251 0.2366737 0.2479731 0.3863850 0.4777949 0.4668405
#> [155] 0.6008496 0.5270147 0.4681518 0.3995069 0.5640533 0.7210520 0.7822007
#> [162] 0.6640068 0.4634991 0.3430926 0.4024507 0.4542483 0.2843378 0.2322979
#> [169] 0.3355924 0.4088314 0.3795264 0.3052135 0.3350716 0.3694766 0.3735194
#> [176] 0.4206008 0.3500911 0.3290737 0.3101313 0.3834745 0.4285028 0.4165993
#> [183] 0.3606658 0.3464090 0.4395068 0.4606924 0.4175034 0.3244208 0.3806007
#> [190] 0.4183460 0.4938785 0.4269831 0.3840027 0.4075668 0.4168500 0.3919631
#> [197] 0.4313996 0.5457142 0.6136213 0.4981762 0.5690895 0.6106824 0.5510937
#> [204] 0.4417539 0.2977306 0.2959921 0.4044510 0.5073118 0.5151155 0.4901969
#> [211] 0.5245365 0.5338230 0.3844160 0.3175533 0.3735516 0.3603477 0.3949523
#> [218] 0.5315057 0.3493351 0.4230341 0.5046038 0.4867411 0.4512141 0.4519752
#> [225] 0.4874844 0.4723008 0.3892483 0.3263508 0.3156554 0.3204934 0.3588636
#> [232] 0.4539145 0.4385292 0.4322474 0.4020121 0.3120447 0.4454606 0.4301337
#> [239] 0.4204736 0.4301203 0.3860025 0.4355815 0.4538118 0.5085256 0.4935131
#> [246] 0.4767024 0.4264438 0.5265482 0.4462974 0.4448255 0.3257672 0.3285721
#> [253] 0.3960630 0.3828578 0.5293860 0.5032467 0.4831650 0.5018597 0.4883214
#> [260] 0.4470180 0.4735580 0.3620993 0.3953547 0.4537099 0.5062501 0.5236903
#> [267] 0.4503025 0.4160286 0.5460578 0.5245070 0.4033844 0.3586593 0.3170583
#> [274] 0.3969283 0.3856894 0.4113590 0.3455338 0.3430400 0.3233537 0.3597650
#> [281] 0.3667007 0.3581945 0.4119257 0.5058521 0.4791296 0.4657342 0.4475966
#> [288] 0.4365267 0.3973217 0.4414192 0.4071535 0.4238295 0.4418256 0.3816513
#> [295] 0.3939651 0.4683206 0.4221900 0.4462780 0.4535433 0.3664152 0.3602279
#> [302] 0.4233444 0.4364014 0.3564726 0.3579605 0.4201680 0.4472482 0.5499392
#> [309] 0.4288204 0.3611005 0.4549688 0.4523755 0.3978930 0.2842085 0.3635830
#> [316] 0.3501985 0.4514120 0.4343811 0.4352064 0.3751396 0.4051751 0.4711894
#> [323] 0.5468534 0.4501764 0.4258655 0.4764455 0.5173312 0.4937913 0.4877196
#> [330] 0.4650543 0.4235298 0.2998120 0.4532558 0.4234356 0.2932959 0.2738376
#> [337] 0.3403174 0.3467953 0.3665690 0.4205915 0.4383983 0.4780715 0.5041057
#> [344] 0.5005945 0.4246137 0.4356067 0.3282437 0.3358813 0.3987190 0.3968557
#> [351] 0.4025634 0.3758423 0.3035024 0.3470115 0.3327202 0.3431964 0.3847057
#> [358] 0.4264460 0.3907434 0.4452103 0.4506879 0.4690481 0.4884630 0.4138773
#> [365] 0.3907795 0.4501261 0.3390577 0.3765146 0.4930089 0.4223658 0.4159685
#> [372] 0.5227577 0.5923160 0.6020736 0.5489386 0.5259143 0.5140542 0.4954534
#> [379] 0.4198283 0.4581559 0.4901636 0.5192653 0.5144191 0.4643985 0.4225229
#> [386] 0.3871513 0.5377944 0.5112369 0.4215417 0.2532351 0.3255904 0.3655017
#> [393] 0.3239734 0.2890871 0.4115345 0.4548402 0.3851978 0.4417720 0.4563445
#> [400] 0.4065203 0.4974827 0.5180779 0.4057973 0.3411661 0.3288346 0.4069638
#> [407] 0.4662984 0.5273609 0.5562535 0.6177670 0.4634481 0.3509606 0.3567201
#> [414] 0.5197448 0.4251299 0.4128073 0.4491108 0.4444606 0.3822086 0.4569903
#> [421] 0.3936193 0.4804758 0.4492187 0.3859499 0.4469684 0.4506424 0.4794184
#> [428] 0.4800228 0.4812113 0.4808127 0.5150414 0.4238743 0.4239998 0.4448440
#> [435] 0.4163690 0.4909925 0.4081290 0.4240906 0.5148307 0.4881352 0.4963400
#> [442] 0.4881616 0.5423910 0.5545782 0.5418096 0.4805168 0.3885340 0.3355484
#> [449] 0.2932718 0.2749574 0.2816312 0.3037351 0.3436788 0.3967749 0.3558627
#> [456] 0.2944487 0.3187801 0.3479122 0.3469342 0.3537267 0.3473597 0.4503198
#> [463] 0.4329342 0.5473878 0.5428835 0.5243199 0.4916306 0.5539289 0.5337524
#> [470] 0.4754473 0.4991393 0.4796676 0.5493090 0.6548737 0.5911657 0.5251221
#> [477] 0.5858340 0.5839865 0.4072620 0.4038547 0.3809760 0.3836847 0.3611399
#> [484] 0.3863408 0.2996537 0.4052215 0.4143597 0.4136481 0.4488407 0.4083735
#> [491] 0.3552758 0.4419427 0.4398569 0.4421170 0.4990441 0.4921394 0.4806059
#> [498] 0.4603364 0.3665204 0.4009629