SpendingSpec
SpendingSpec
Details
An R6 class representing a single spending function (fun) and a tuning
specification for its parameter (par).
Public fields
funSpending function (callable with signature
(alpha, t, param)).fun_labelLabel captured from the constructor call (used for plotting).
parTuning specification for the spending parameter.
Methods
Method new()
Create a new spending specification.
Usage
SpendingSpec$new(fun, par = tune_fixed(NULL))Examples
spec <- SpendingSpec$new(gsDesign::sfHSD, par = tune_seq(-4, -2, length_out = 2))
spec$expand()
#> [[1]]
#> $fun
#> function (alpha, t, param)
#> {
#> checkScalar(alpha, "numeric", c(0, Inf), c(FALSE, FALSE))
#> checkScalar(param, "numeric", c(-40, 40))
#> checkVector(t, "numeric", c(0, Inf), c(TRUE, FALSE))
#> t[t > 1] <- 1
#> x <- list(name = "Hwang-Shih-DeCani", param = param, parname = "gamma",
#> sf = sfHSD, spend = if (param == 0) t * alpha else alpha *
#> (1 - exp(-t * param))/(1 - exp(-param)), bound = NULL,
#> prob = NULL)
#> class(x) <- "spendfn"
#> x
#> }
#> <bytecode: 0x55b431fee0d8>
#> <environment: namespace:gsDesign>
#>
#> $fun_label
#> [1] "gsDesign::sfHSD"
#>
#> $par
#> [1] -4
#>
#> attr(,"class")
#> [1] "gstune_spending"
#>
#> [[2]]
#> $fun
#> function (alpha, t, param)
#> {
#> checkScalar(alpha, "numeric", c(0, Inf), c(FALSE, FALSE))
#> checkScalar(param, "numeric", c(-40, 40))
#> checkVector(t, "numeric", c(0, Inf), c(TRUE, FALSE))
#> t[t > 1] <- 1
#> x <- list(name = "Hwang-Shih-DeCani", param = param, parname = "gamma",
#> sf = sfHSD, spend = if (param == 0) t * alpha else alpha *
#> (1 - exp(-t * param))/(1 - exp(-param)), bound = NULL,
#> prob = NULL)
#> class(x) <- "spendfn"
#> x
#> }
#> <bytecode: 0x55b431fee0d8>
#> <environment: namespace:gsDesign>
#>
#> $fun_label
#> [1] "gsDesign::sfHSD"
#>
#> $par
#> [1] -2
#>
#> attr(,"class")
#> [1] "gstune_spending"
#>