Skip to contents

[Stable]

A function that computes the dose reaching a specific target value of a given variable that dose depends on. The meaning of this variable depends on the type of the model. For instance, for single agent dose escalation model or pseudo DLE (dose-limiting events)/toxicity model, this variable represents the a probability of the occurrence of a DLE. For efficacy models, it represents expected efficacy. The doses are computed based on the samples of the model parameters (samples).

Usage

dose(x, model, samples, ...)

# S4 method for numeric,LogisticNormal,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticLogNormal,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticLogNormalOrdinal,Samples
dose(x, model, samples, grade)

# S4 method for numeric,LogisticLogNormalSub,Samples
dose(x, model, samples)

# S4 method for numeric,ProbitLogNormal,Samples
dose(x, model, samples)

# S4 method for numeric,ProbitLogNormalRel,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticLogNormalGrouped,Samples
dose(x, model, samples, group)

# S4 method for numeric,LogisticKadane,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticKadaneBetaGamma,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticNormalMixture,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticNormalFixedMixture,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticLogNormalMixture,Samples
dose(x, model, samples)

# S4 method for numeric,DualEndpoint,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticIndepBeta,Samples
dose(x, model, samples)

# S4 method for numeric,LogisticIndepBeta,missing
dose(x, model)

# S4 method for numeric,Effloglog,missing
dose(x, model)

# S4 method for numeric,EffFlexi,Samples
dose(x, model, samples)

# S4 method for numeric,OneParLogNormalPrior,Samples
dose(x, model, samples)

# S4 method for numeric,OneParExpPrior,Samples
dose(x, model, samples)

Arguments

x

(proportion or numeric)
a value of an independent variable on which dose depends. The following recycling rule applies when samples is not missing: vectors of size 1 will be recycled to the size of the sample (i.e. size(samples)). Otherwise, x must have the same size as the sample.

model

(GeneralModel or ModelPseudo)
the model.

samples

(Samples)
the samples of model's parameters that will be used to compute the resulting doses. Can also be missing for some models.

...

model specific parameters when samples are not used.

grade

(integer)
The toxicity grade for which probabilities are required

group

(character or factor)
for LogisticLogNormalGrouped, indicating whether to calculate the dose for the mono or for the combo arm.

Value

A number or numeric vector with the doses. If non-scalar samples were used, then every element in the returned vector corresponds to one element of a sample. Hence, in this case, the output vector is of the same length as the sample vector. If scalar samples were used or no samples were used, e.g. for pseudo DLE/toxicity model, then the output is of the same length as the length of the prob.

Details

The dose() function computes the doses corresponding to a value of a given independent variable, using samples of the model parameter(s). If you work with multivariate model parameters, then assume that your model specific dose() method receives a samples matrix where the rows correspond to the sampling index, i.e. the layout is then nSamples x dimParameter.

Functions

  • dose(x = numeric, model = LogisticNormal, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticLogNormal, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticLogNormalOrdinal, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

    In the case of a LogisticLogNormalOrdinal model, dose returns only the probability of toxicity at the given grade or higher

  • dose(x = numeric, model = LogisticLogNormalSub, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = ProbitLogNormal, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = ProbitLogNormalRel, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticLogNormalGrouped, samples = Samples): method for LogisticLogNormalGrouped which needs group argument in addition.

  • dose(x = numeric, model = LogisticKadane, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticKadaneBetaGamma, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticNormalMixture, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticNormalFixedMixture, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticLogNormalMixture, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = DualEndpoint, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticIndepBeta, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x).

  • dose(x = numeric, model = LogisticIndepBeta, samples = missing): compute the dose level reaching a specific target probability of the occurrence of a DLE (x). All model parameters (except x) should be present in the model object.

  • dose(x = numeric, model = Effloglog, samples = missing): compute the dose level reaching a specific target probability of the occurrence of a DLE (x). All model parameters (except x) should be present in the model object.

  • dose(x = numeric, model = EffFlexi, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLE (x). For this method x must be a scalar.

  • dose(x = numeric, model = OneParLogNormalPrior, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLT (x).

  • dose(x = numeric, model = OneParExpPrior, samples = Samples): compute the dose level reaching a specific target probability of the occurrence of a DLT (x).

Note

The dose() and prob() methods are the inverse of each other, for all dose() methods for which its first argument, i.e. a given independent variable that dose depends on, represents toxicity probability.

Examples

# Create some data.
my_data <- Data(
  x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
  y = c(0, 0, 0, 0, 0, 0, 1, 0),
  cohort = c(0, 1, 2, 3, 4, 5, 5, 5),
  doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
#> Used default patient IDs!

# Initialize a model, e.g. 'LogisticLogNormal'.
my_model <- LogisticLogNormal(
  mean = c(-0.85, 1),
  cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
  ref_dose = 56
)

# Get samples from posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 20)
my_samples <- mcmc(data = my_data, model = my_model, options = my_options)

# Posterior for the dose achieving Prob(DLT) = 0.45.
dose(x = 0.45, model = my_model, samples = my_samples)
#>  [1]  41.56066  41.56066  41.56066  71.99341 155.02621  92.08929  60.25945
#>  [8]  60.25945  60.25945  37.50733  19.97471  19.97471  20.03481  39.93760
#> [15]  39.93760  39.93760  46.17990  51.42044  51.42044  51.42044

# Create data from the 'Data' (or 'DataDual') class.
dlt_data <- Data(
  x = c(25, 50, 25, 50, 75, 300, 250, 150),
  y = c(0, 0, 0, 0, 0, 1, 1, 0),
  doseGrid = seq(from = 25, to = 300, by = 25)
)
#> Used default patient IDs!
#> Used best guess cohort indices!

# Initialize a toxicity model using 'LogisticIndepBeta' model.
dlt_model <- LogisticIndepBeta(
  binDLE = c(1.05, 1.8),
  DLEweights = c(3, 3),
  DLEdose = c(25, 300),
  data = dlt_data
)

# Get samples from posterior.
dlt_sample <- mcmc(data = dlt_data, model = dlt_model, options = my_options)

# Posterior for the dose achieving Prob(DLT) = 0.45.
dose(x = 0.45, model = dlt_model, samples = dlt_sample)
#>  [1]     10.07613     10.07613     22.15191 850756.88704     48.50700
#>  [6]     48.50700     48.50700     72.06078     72.06078     72.06078
#> [11]   2590.71936    155.17055    155.17055    155.17055    212.47066
#> [16]    156.91934    234.83714    234.83714    196.82793     90.86247
dose(x = c(0.45, 0.6), model = dlt_model)
#> [1] 144.6624 247.7348
data_ordinal <- .DefaultDataOrdinal()
model <- .DefaultLogisticLogNormalOrdinal()
options <- .DefaultMcmcOptions()
samples <- mcmc(data_ordinal, model, options)
#> Warning: Unused variable "y" in data

dose(0.25, model, samples, grade = 2L)
#>    [1]    66.07520    61.08300    76.15262    83.47429    60.17843    64.77986
#>    [7]    72.99826    57.73981    58.41763    56.59639    92.75554   253.80308
#>   [13]   240.58223   349.67579    65.83493   144.92998   266.53447    60.37094
#>   [19]    62.16265    58.82040    61.01682    96.77802   114.72857    57.33542
#>   [25]    73.40131    67.21688    71.18746    59.49147    56.85420    90.90860
#>   [31]   163.07651    61.27820    63.83218   109.54538    59.21033    56.05853
#>   [37]    69.25195    59.77095   122.31732    53.46954    68.72654    66.06694
#>   [43]    57.92578    63.07911    79.44305    57.73879    73.92113    66.09630
#>   [49]    68.27778   107.25606    57.20848    70.14217    86.56300    64.42141
#>   [55]    66.47697    60.30376    63.96431    75.65355    54.16039    62.19713
#>   [61]    77.26086    57.18139    70.80352    59.78917    69.80448    69.93424
#>   [67]    61.91771    59.90926    69.93061    65.38790    60.61468    57.02712
#>   [73]   149.01886   169.72957    82.15397    89.33145    80.30771    54.15646
#>   [79]    75.42805    90.36483   267.91144    66.47167    57.04119    68.79336
#>   [85]    66.09059    73.89822   162.35059   109.80887    54.35504    98.42235
#>   [91]   115.26078   149.21183    81.06245    71.25048    60.19240    59.80886
#>   [97]    67.93010    52.12529    63.35995    61.39031    59.86440    68.32096
#>  [103]    90.31110    54.10704    52.66232    58.51778    63.78642    71.52867
#>  [109]   114.84779    91.44784    59.33136    63.15201    60.51489    63.66285
#>  [115]    63.65816    83.22411    56.58357    66.11112    55.79289    53.49290
#>  [121]    64.83649    59.59579    73.72573    54.04188    56.07011    82.81573
#>  [127]    67.37660   106.61631   126.13670    61.64790    58.40008    63.79393
#>  [133]    79.57368   204.90757   501.76857    80.88440    77.91787   293.30471
#>  [139]    79.50777    61.71546    55.98197    63.41835   142.19239    60.84721
#>  [145]    68.84292    91.50405    74.18690    57.51296    69.75180   125.83319
#>  [151]    79.85351    60.26979    58.59972    62.16230    60.48844    59.71869
#>  [157]    63.58365    72.94266    57.74211   166.43858   205.93440  1336.62160
#>  [163]    55.55510   137.88810    93.53126    59.75831    66.92376    64.92147
#>  [169]    58.77459    70.74464    77.80667    60.01265    52.95637    74.47933
#>  [175]    87.73729    57.68402    65.70193    59.82847    61.67907    76.14954
#>  [181]    59.78918    80.05720    61.01249    65.03557    99.01964    58.51246
#>  [187]    78.45733    64.49683    63.71557    67.24439    57.82793    69.81081
#>  [193]    73.99580    65.90770    57.73934    58.99676    83.03459    72.36505
#>  [199]    95.21867    74.62707    56.25393    70.93395    64.09806    71.04354
#>  [205]    79.11518    58.30306    72.69577    62.61934    57.99542    73.84334
#>  [211]    70.02940    62.24713    56.15191    78.43231    57.40697    73.69682
#>  [217]   100.50169    63.25973    68.78595   119.15407    81.37355    81.17526
#>  [223]    67.96611  1084.47837   190.92442    64.28692    67.70391    87.80182
#>  [229]    63.37990    62.93045    74.63468    93.61267    58.86755    63.83991
#>  [235]    60.23793    68.14608    65.79669    55.28118    49.95446    96.56575
#>  [241]    58.87900    62.50019    51.44152    74.30917    58.80982   555.33963
#>  [247]    54.56853   120.14220   131.71704    61.16658    59.89960   119.62210
#>  [253]    88.14017    59.36379    68.99625    63.54986    59.28268    66.30933
#>  [259]   103.72353    62.17441    58.24677    57.89241    74.30192    58.26551
#>  [265]    99.14392    61.25630    64.29739    80.03213    49.95629    56.03161
#>  [271]    88.37938   102.28455    59.90088    57.26105    62.53975    70.71031
#>  [277]    49.39472    69.92938   241.88754   650.30644   150.38083    65.57173
#>  [283]    65.29885    60.60060    59.23170    66.41232  1019.20510    51.14487
#>  [289]    74.88636    61.98775    72.33925    61.98195    66.79417    58.72124
#>  [295]    66.49096    59.53943    64.82151    60.02819   123.65134   105.56820
#>  [301]    89.91657    58.70548   144.81957    63.83949    71.28684    65.15442
#>  [307]    59.79999    61.35026   106.87089    62.89676    61.94574    52.32669
#>  [313]    56.90432    64.34953    59.28864    62.22842   128.16842    88.55196
#>  [319]    59.09323    57.61137    63.70021    55.75829    68.26754    48.79942
#>  [325]    55.51148    66.22252    97.51135    53.37004   146.09994    58.55488
#>  [331]   113.05343    59.71473    61.84893    56.47677    63.31413   106.05441
#>  [337]    62.09883    60.45675    89.84748    64.52817    84.00154    54.62900
#>  [343]    55.92233    77.13786    70.01635    59.50358    55.39838   199.50636
#>  [349]   214.49093    69.51872   107.42400    54.89217    77.69169    73.18161
#>  [355]    59.41595   108.23046    58.09553    57.56903    58.13688    55.87974
#>  [361]    61.12245    57.85546    89.87643    70.67806    80.31927    73.95165
#>  [367]   145.04205   178.94633    56.57177    85.60602    61.41169    70.96007
#>  [373]    74.16591    57.69662    62.70932   119.09367    77.18156    60.68360
#>  [379]    56.97567    56.81385    70.32677   338.53207    67.70863    59.84382
#>  [385]    70.34075    68.71287   183.61815   494.59252   131.54095    64.69081
#>  [391]    55.72149    74.58706    82.86996    67.76467    55.30954    65.55180
#>  [397]    64.34361    62.94428    61.40047    70.49512    57.22741    69.77043
#>  [403]    59.64648    71.61247    85.80182    55.32754    65.19200    59.99446
#>  [409]    59.77707    77.23507    76.77995   121.00048   202.96755    63.21450
#>  [415]    63.83243    70.25740    59.37251   112.87709    60.02814    76.99862
#>  [421]    93.53421    66.47291    88.81575    70.78310    84.50707  2391.49134
#>  [427]   102.92868    64.85589    76.71534    84.12901    59.93401    67.17862
#>  [433]    61.86026    57.76407    60.08138    64.71092    92.54036    55.74813
#>  [439]    72.89777    67.86105    59.49417    72.00953   508.61058    64.61116
#>  [445]    65.31073   177.02469    63.07156    57.05333    64.07833    89.93729
#>  [451]    97.54324    59.00083    60.23209   110.70463    97.36275    65.30837
#>  [457]    75.33278    70.88995    61.18568    62.63206    65.80562    73.25288
#>  [463]    57.29102   116.49838    55.74859   159.38714    57.84735    62.88790
#>  [469]    67.00030    75.89714    66.23468    64.88535   598.17662    68.02526
#>  [475]    57.24255    61.56668    68.29990    67.13373    59.88764    87.94152
#>  [481]    54.69080   101.28851    69.88483    65.53649   146.44207    75.16010
#>  [487]    58.85355    58.06277    55.51338    72.64313    58.09768    56.39200
#>  [493]   158.99461    89.44031    88.58510    66.61334    54.54921   108.82718
#>  [499]    64.49112    74.35716  3501.67158   110.89290   181.86623    56.98284
#>  [505]    63.93664    60.41677    54.08075    87.15187  5393.28675   170.30287
#>  [511] 31901.39568   682.49118    79.28083    85.98816    53.63070    64.51774
#>  [517]   117.44831   127.12609    73.96513   241.12217    81.34348    67.04785
#>  [523]    73.76605    78.39764    83.66275    55.28614    59.93011    61.03606
#>  [529]    84.20291   152.99654    72.53878    41.94963    61.68296    68.13065
#>  [535]    69.43050    72.92778    58.04889    62.49362    79.23209    57.55147
#>  [541]    56.17844    52.79249    62.18176    91.31923    58.51250    62.45930
#>  [547]    84.90566    60.23316    68.40809  9469.34227    68.29812    92.22432
#>  [553]    59.88389    87.78886    84.52926    60.79037    61.25118    64.63687
#>  [559]    82.16562   100.44388    56.95006    65.04107   125.41708   122.12359
#>  [565]    80.53909    87.26375    70.18771    66.08485    55.59482    79.49064
#>  [571]   198.94407    77.50294   152.49729   121.23691   251.78523   118.47988
#>  [577]    54.06208    63.35871    61.11754    88.68571   105.57909    95.23491
#>  [583]    61.73542    63.27881    95.52518   113.09539   124.13287    97.40608
#>  [589]    55.60131    75.29585    63.26746    57.32862    70.22594    73.49275
#>  [595]   177.16466   139.83845   921.56779  1442.68636    58.19714    60.79425
#>  [601]    56.92430    57.79703    84.16198   263.63408   202.26722    78.62526
#>  [607]    57.69704    65.95459    86.37350    58.59737    60.62321    59.82175
#>  [613]    71.40231   210.55298    97.52138    67.28172    62.08389    59.17367
#>  [619]    66.58042    99.48285    81.88583    54.04377    77.80113    70.83389
#>  [625]    94.50517   202.31324  2141.09766    83.16301   122.45662    56.49211
#>  [631]    63.60239    54.69072    60.57524    60.57841   119.51698    78.26182
#>  [637]    58.15718    55.59131    57.99808   259.91544    60.92896    56.44035
#>  [643]    59.93401   230.26231    60.72489    59.64239   112.04373   134.10354
#>  [649]    61.69851    56.93391    53.23962    62.29205   131.77925    81.34570
#>  [655]    54.63316    60.56425    58.55654    63.49116    70.17445   309.91411
#>  [661]   991.53268    66.52219    63.63528    62.80000    66.85555    58.43228
#>  [667]   151.01201    66.48049    89.16396   170.61453   141.24629    75.09816
#>  [673]    86.85418    78.58872    62.01993    62.42726    65.78144   156.62804
#>  [679]    58.50840    85.29922    87.28206    61.90737    58.00194    79.27219
#>  [685]    75.10377    53.51461   104.03589    54.49345    55.98998    65.27136
#>  [691]   104.60986   104.03580    66.24396    58.81110    70.85218    60.86713
#>  [697]    55.23185    57.74325    74.87498    97.15822   102.67595   117.46278
#>  [703]    61.69167   120.41804    62.14557    64.84509    78.22917    56.09853
#>  [709]    61.11440    71.83895    69.31492    65.02808    58.76659    65.54994
#>  [715]    81.72544    92.46902    95.87010    66.71112    92.69534    60.18555
#>  [721]    63.44475    68.42171    63.53734    56.00148    93.11214    62.60792
#>  [727]    61.42634    60.15825   127.91178    72.78889    60.35132    58.87335
#>  [733]    78.38057    88.06446    80.80705    53.58566    58.27767    66.87579
#>  [739]    61.05356    75.42859    57.36241   172.68151   101.95209    61.47146
#>  [745]    68.66093    58.05448    59.43166    68.76280   103.14476   114.63595
#>  [751]   622.25362   222.94308   135.79194    64.27772    60.69795    91.23301
#>  [757]    48.61924    80.75222    67.75902    82.28554    65.55032    68.13425
#>  [763]    59.12799    62.03315    81.40562    64.36386    57.12992    66.86147
#>  [769]    70.47417    79.64640   128.98429    72.04402    59.08023    79.50329
#>  [775]    61.83102    60.69912    78.25068    65.89107    63.96416    56.29142
#>  [781]    82.02093    56.31948    88.59021   249.69694    80.28229   141.91326
#>  [787]    55.34266    87.34149    63.39857    77.15425    65.66089    62.43839
#>  [793]   128.45258    61.38677    55.91381    62.35237    68.51142    90.25432
#>  [799]    58.93906    64.34589    63.18804    60.60582   148.51455    75.26704
#>  [805]    58.33938    72.08102   152.47315    57.57289    62.53949    59.12800
#>  [811]    59.68089    62.91155    56.11251    66.84659    69.25661    74.67568
#>  [817]    57.87790    61.01823    62.71737    60.88661    81.00258    96.65311
#>  [823]    53.82560    68.11794    75.37969    59.47665    81.00025   854.77425
#>  [829]  6827.19360   214.07965    57.26199    59.97581    66.63219    65.88275
#>  [835]    64.32640    65.15567    61.59271    67.49849   130.55662   131.24085
#>  [841]    99.89431    97.65870    53.94421   107.40847    60.92546    53.22494
#>  [847]    59.78243    87.19408    59.95249    54.29132    63.27307    86.02191
#>  [853]    69.86104    61.06065    54.78935    57.02174    61.09832   129.75891
#>  [859]    54.04988    63.34186    60.41542    63.00762    62.21385    87.72803
#>  [865]    63.42007    61.76385    56.41218    85.49442    52.91071    60.07299
#>  [871]    59.80442    71.45256    64.49521    85.73424    66.83804    89.19792
#>  [877]    68.73213    59.88153    70.20294    57.93322    56.07507    63.11063
#>  [883]    57.22701    71.98468    67.74792    64.32974    56.76483    98.30032
#>  [889]    56.65536    63.82937    59.61358    70.36302    56.75255   404.63390
#>  [895]   526.65840   239.71642   102.90413    59.05425    63.35038    54.71617
#>  [901]    60.84603   144.62554   105.70448    68.60926    64.31514    61.69997
#>  [907]    64.22001    67.57138    70.37638    60.52100    69.88037    69.21348
#>  [913]    62.08789   142.42013   133.73320    89.74602    63.07910    74.89157
#>  [919]    54.73143    64.58380    57.79274    66.93055    60.06419    64.42766
#>  [925]    66.55770    79.41137   133.21290  2161.75599    74.77025    51.99680
#>  [931]    59.05751    72.70578    56.80211    76.03514    63.91793    67.17709
#>  [937]    60.15831    71.06421    46.06837   221.48864    57.50227    61.63267
#>  [943]    59.07225   227.96803    67.94468    60.20115    69.63022    65.42689
#>  [949]    66.63143    61.46353    76.10689    96.67576    80.48124   134.77705
#>  [955]    71.62172    76.66603    88.73064    69.17014    54.52583    90.63418
#>  [961]    68.51733    52.00745    64.76441    66.97515    64.48971    64.32554
#>  [967]   139.31996    52.43975    55.44642   658.00033    62.43100    57.98204
#>  [973]   149.08745    57.50710    84.27164    65.18285    59.76262    86.15766
#>  [979]    62.98944    70.17326   102.86325    60.31634    61.18076    83.78990
#>  [985]    58.57603   100.56923    94.67110    54.26612    85.62390    56.05818
#>  [991]    59.02113    64.07938    72.45904    67.90281   144.73576 15251.35398
#>  [997]   290.74519    72.90779   267.87813   209.44560