Skip to contents

[Experimental]

Usage

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. See Data for 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.

Value

The biomarker levels.

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):

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.39308712  0.40654225  0.43370971  0.39276324  0.38863022  0.31367627
#>   [7]  0.27558324  0.37032295  0.40616447  0.35839564  0.38668611  0.36246081
#>  [13]  0.36724200  0.39998700  0.36807695  0.37361258  0.35693000  0.28145816
#>  [19]  0.11883598  0.16207586  0.26626122  0.34350131  0.39292524  0.31491453
#>  [25]  0.31826275  0.45435923  0.47902842  0.52378386  0.50427392  0.53625455
#>  [31]  0.48021906  0.45111006  0.39350075  0.30015349  0.43219968  0.41358752
#>  [37]  0.37373453  0.38352637  0.45866401  0.52034754  0.52576558  0.51977900
#>  [43]  0.36479257  0.40305581  0.45609250  0.40714936  0.44317857  0.42815040
#>  [49]  0.39874037  0.39206962  0.37855864  0.43186632  0.55175785  0.52588817
#>  [55]  0.63539921  0.70049025  0.50327809  0.50969882  0.42797236  0.40807520
#>  [61]  0.36694719  0.38568833  0.39416008  0.47404443  0.40408221  0.34839761
#>  [67]  0.29640341  0.43004508  0.41390208  0.39977708  0.37845252  0.41643905
#>  [73]  0.48646349  0.43532171  0.42731539  0.42533261  0.48729906  0.58426026
#>  [79]  0.54797470  0.45827535  0.45351933  0.38573890  0.43744659  0.57507765
#>  [85]  0.63243893  0.63044055  0.68485099  0.58005397  0.52562721  0.48618750
#>  [91]  0.44662897  0.44819648  0.28928374  0.21620025  0.17259309 -0.11097190
#>  [97]  0.05568965  0.16617959  0.48949129  0.45058975  0.44741294  0.47859349
#> [103]  0.52239486  0.53091985  0.42380252  0.45292971  0.39368497  0.27289887
#> [109]  0.33290268  0.28882489  0.37067482  0.27702977  0.22039160  0.21674679
#> [115]  0.31627081  0.22442580  0.28911110  0.40481628  0.50320891  0.51387972
#> [121]  0.54554219  0.43899862  0.35845075  0.35305032  0.41964125  0.41855276
#> [127]  0.46447683  0.49871169  0.55180985  0.57889428  0.60475961  0.53279132
#> [133]  0.48907207  0.56702934  0.53092524  0.51237444  0.55220485  0.35791901
#> [139]  0.42025887  0.49214894  0.54176332  0.52495157  0.50084886  0.45718359
#> [145]  0.32822244  0.42465729  0.46386045  0.48104617  0.45468873  0.49796432
#> [151]  0.45345125  0.36573996  0.31859414  0.37639966  0.38580164  0.36180348
#> [157]  0.47180810  0.46596469  0.51173447  0.39701281  0.46146373  0.47441604
#> [163]  0.44644661  0.49095758  0.48375592  0.50766490  0.46640442  0.50329773
#> [169]  0.44414732  0.41645133  0.38145211  0.44291825  0.31256555  0.45652136
#> [175]  0.46081816  0.37878557  0.33558322  0.31368780  0.45344054  0.49713169
#> [181]  0.47717870  0.50656817  0.56849632  0.47333406  0.58676943  0.61394245
#> [187]  0.64338256  0.48808817  0.45529877  0.40007030  0.34265288  0.28386982
#> [193]  0.35526519  0.43161571  0.43005538  0.42834809  0.41123343  0.53566050
#> [199]  0.55359588  0.61836912  0.60807068  0.58801218  0.44370642  0.61553765
#> [205]  0.49241285  0.39335454  0.45305576  0.51724401  0.51807324  0.48131570
#> [211]  0.41384227  0.50705483  0.40478603  0.44964683  0.37568391  0.40448047
#> [217]  0.37985109  0.35480022  0.37619092  0.31047753  0.49083990  0.46170344
#> [223]  0.50339333  0.39288577  0.44710091  0.49949772  0.46795856  0.44410629
#> [229]  0.38663646  0.45557225  0.45599826  0.50509128  0.56227511  0.67294067
#> [235]  0.54928808  0.55935696  0.44965302  0.39936998  0.36330182  0.22834027
#> [241]  0.30210980  0.42556927  0.41281124  0.36487639  0.36280339  0.28050467
#> [247]  0.23469263  0.24974494  0.27058572  0.39746616  0.42832730  0.39540364
#> [253]  0.66507415  0.47988744  0.56175584  0.49432697  0.49933491  0.51600646
#> [259]  0.60977880  0.51351884  0.54430651  0.30579221  0.24502620  0.35380351
#> [265]  0.36465934  0.37356521  0.45041674  0.41189678  0.42468749  0.42844403
#> [271]  0.45086742  0.44942026  0.50763762  0.47435358  0.40033807  0.36163264
#> [277]  0.32737504  0.33999005  0.31956002  0.34150279  0.25871947  0.42992192
#> [283]  0.57110596  0.46448303  0.45931770  0.52973923  0.40304786  0.26285372
#> [289]  0.34636300  0.44669870  0.42838015  0.42840587  0.39506069  0.45872960
#> [295]  0.50173856  0.55582776  0.59494751  0.48108685  0.35583956  0.40562319
#> [301]  0.46463661  0.51940091  0.42149303  0.41307395  0.44183557  0.52812836
#> [307]  0.53374611  0.53548687  0.41288451  0.49077314  0.46243638  0.58033559
#> [313]  0.54596081  0.52231622  0.41767198  0.44412402  0.30564715  0.31878888
#> [319]  0.53179165  0.45463143  0.38609391  0.35328767  0.29470007  0.32495904
#> [325]  0.39707203  0.41367914  0.46525452  0.48233349  0.48449738  0.43937576
#> [331]  0.40794420  0.37369831  0.35135463  0.43104331  0.48050203  0.42502704
#> [337]  0.44078835  0.34524029  0.25749333  0.32326520  0.36547166  0.40351173
#> [343]  0.42995453  0.36278025  0.36349067  0.42362240  0.40250350  0.33573749
#> [349]  0.45921527  0.42743978  0.40540605  0.40510193  0.38027037  0.39533117
#> [355]  0.36504458  0.34714501  0.34377288  0.34811352  0.29268721  0.18393276
#> [361]  0.07662493  0.09867589  0.18029110  0.28546375  0.39193732  0.35374201
#> [367]  0.47392828  0.52247580  0.50259328  0.37618370  0.34862806  0.30846601
#> [373]  0.39109288  0.44687798  0.31633547  0.42063151  0.41545887  0.42790556
#> [379]  0.45184662  0.41180055  0.48926879  0.52691589  0.49238021  0.45941699
#> [385]  0.49580743  0.40599309  0.43936970  0.48367275  0.36321590  0.28148263
#> [391]  0.24373382  0.40729776  0.37281782  0.38539179  0.33898892  0.35749007
#> [397]  0.33499457  0.23970260  0.34827700  0.36835797  0.38298880  0.45047670
#> [403]  0.55526690  0.46935475  0.50545417  0.51813368  0.44254518  0.40205993
#> [409]  0.44851159  0.41218329  0.43375217  0.31455886  0.44683985  0.36658782
#> [415]  0.36669468  0.33346185  0.39986784  0.32066053  0.36820316  0.35364308
#> [421]  0.43252151  0.46359764  0.47788503  0.46189618  0.44853196  0.46542908
#> [427]  0.47962463  0.41285996  0.37294950  0.34146042  0.31128928  0.26649729
#> [433]  0.25667688  0.29957348  0.32717617  0.33246696  0.38373918  0.42398666
#> [439]  0.42565369  0.45513421  0.46986014  0.45822848  0.44567152  0.45391053
#> [445]  0.48729322  0.44226984  0.41533180  0.42950030  0.57071751  0.44655199
#> [451]  0.46010872  0.17865207  0.35048336  0.35771681  0.40837415  0.35323660
#> [457]  0.49103834  0.47319060  0.49343477  0.40665655  0.48905516  0.57384089
#> [463]  0.57807269  0.57059766  0.52982403  0.53591906  0.40851816  0.31856193
#> [469]  0.39848109  0.33936727  0.50308291  0.46852178  0.31164200  0.50371587
#> [475]  0.55705868  0.40625109  0.35708965  0.35944284  0.40252315  0.39968038
#> [481]  0.38292287  0.44193395  0.48057391  0.56965614  0.51384920  0.51258239
#> [487]  0.51555392  0.38401450  0.33829671  0.43487270  0.54697530  0.56760979
#> [493]  0.65309301  0.41934016  0.24104787  0.29656907  0.29315768  0.25306440
#> [499]  0.40895012  0.51303070