An R6 base class for hyperpriors over MTDi distributions
An R6 base class for hyperpriors over MTDi distributions
new()
HyperMTDi_lognormal$new(CV, median_mtd, median_sdlog, units, n = 100)
CV
Coefficient of variation of median MTDi
median_mtd
Median MTDi in the population
median_sdlog
Uncertainty in median MTDi, on log scale
units
A short string specifying dose units
n
Number of samples to draw
Create a new HyperMTDi
object.
A HyperMTDi
object.
resample()
HyperMTDi_lognormal$resample(n)
n
Number of samples to draw
Draw fresh samples
Self, invisibly
nsamples()
HyperMTDi_lognormal$nsamples()
Get number of samples TODO: Consider a higher-level interface to progress-bar info
Number of samples drawn so far
extend()
HyperMTDi_lognormal$extend(n = 1)
n
Number of additional MTDi scenarios to sample
Extend the samples, typically improving the approximation TODO: Investigate how much variance reduction QRNG yields.
Self, invisibly
doses()
HyperMTDi_lognormal$doses(x)
x
A vector of dose levels
Set or query the vector of prespecified dose levels
Self (invisibly), unless x
is missing,
in which case the dose vector is returned.
skeleton()
HyperMTDi_lognormal$skeleton(p)
p
A vector of probabilities, one for each prespecified dose
Set or query a 'skeleton' probability vector
Self (invisibly), unless p
is missing, in which case the
skeleton probabilities are returned (after being calculated from the
sample if not already set explicitly).
apply()
HyperMTDi_lognormal$apply(f, ...)
f
A closure that realizes a distribution-type function (such as a quantile function or CDF) when evaluated in the environment defined by any row of the sampled parameters.
...
Arguments upon which to evaluate the enclosed function
Apply a distribution-type function over the sampled realizations TODO: Consider taking this method private.
A list of values of f
avg_tox_probs()
HyperMTDi_lognormal$avg_tox_probs()
Get average toxicity probabilities over the sample
Toxicity probabilities at fixed doses, averaged over sample
fractionate()
HyperMTDi_lognormal$fractionate(cpe, kappa)
cpe
An object of class Cpe
kappa
A log-therapeutic index as in Eq (5) of Norris2020c
Return expected counts of ordinal toxicities
An nsamples
-by-6 matrix, each row being the expected counts
for toxicity grades 0 through 5, at one sampled scenario.
plot()
HyperMTDi_lognormal$plot(col = "gray", xlim = NULL, ...)
col
Color of lines used to depict samples
xlim
May be used to override the default dose-axis limits, which span the 1% to 99% quantiles of all samples.
...
Additional arguments passed onward to plot
Visualize the samples of a HyperMTDi
object
if (interactive()) { mtdi_gen <- HyperMTDi_lognormal$new(CV = 1 ,median_mtd = 5 ,median_sdlog = 0.5 ,units="mg/kg") mtdi_gen$plot() }
clone()
The objects of this class are cloneable with this method.
HyperMTDi_lognormal$clone(deep = FALSE)
deep
Whether to make a deep clone.
With CPE liberating precautionary
from the need for nested simulations,
the opportunity arises for a more encapsulated treatment of MTDi scenario
generators ('hyperpriors') and their sampling. Specifically, individual
sampled scenarios need only yield two functions:
A CDF taking a dose vector $$X = (X_1,...,X_d)$$ to probabilities $$p = (p_1,...,p_d)$$
A function F(X,kappa) yielding a fractionation matrix $F = [0 G; H 0]$. Crucially, this class actually represents an APPROXIMATION to the hyperprior, via a finite set of samples from it. The use of reference classes enables us to improve this approximation efficiently by in-place updating.
Documentation for Cpe-class
# NOT RUN {
## ------------------------------------------------
## Method `HyperMTDi_lognormal$plot`
## ------------------------------------------------
if (interactive()) {
mtdi_gen <- HyperMTDi_lognormal$new(CV = 1
,median_mtd = 5
,median_sdlog = 0.5
,units="mg/kg")
mtdi_gen$plot()
}
# }
Run the code above in your browser using DataLab