This function constructs an adaptor object from exactly one of:
indices: A numeric vector of positive integer indices, used to subsettheta.fixed_param: A numeric value (or vector) to be returned regardless oftheta.r_func: A custom R function of the formfunction(theta) -> numeric.
Examples
if (FALSE) { # \dontrun{
# Example 1: Fixed and index-based parameter adaptors
# Create a CGF object for a binomial distribution with a fixed parameter `n = 10`.
# This configuration allows passing only the `prob` parameter in subsequent uses.
binom_cgf <- BinomialModelCGF(n = adaptor(fixed_param = 10), prob = adaptor(indices = 1))
# The object binom_cgf will expect only `prob` to be passed,
# since `n` is already set.
binom_cgf$K1(tvec = 0, parameter_vector = 0.3)
# Example 2: Function adaptor
# Dynamically compute probability parameter based on the input vector.
cgf <- BinomialModelCGF(n = adaptor(indices = 2), prob = function(y) y[1])
cgf$K1(tvec = 0, parameter_vector = c(0.3, 10))
} # }