Generate a Sequence of Tuning Parameters (eta)
generate_eta.RdProduces a numeric vector of eta values to be used in Cox–KL model.
Arguments
- method
Character string selecting how to generate
eta: “linear” or “exponential”. Default is “exponential”. for an exponentially spaced sequence scaled tomax_eta. Default is"exponential".- n
Integer, the number of
etavalues to generate. Default is 10.- max_eta
Numeric, the maximum value of
etain the sequence. Default is 5.- min_eta
Numeric, the minimum value of
etain the sequence. Default is 0.
Details
Exponential: values are formed by exponentiating a grid from
log(1)tolog(100), then linearly rescaling to the interval[0, max_eta]. Thus the smallest value equals0and the largest equalsmax_eta.Linear: the current implementation calls
seq(min_eta, max_eta, length.out = n)and therefore assumes a numeric objectmin_etaexists in the calling environment.
Only the exact strings “linear” and “exponential” are supported;
other values for method will result in an error because eta_values
is never created.
Examples
# Generate 10 exponentially spaced eta values up to 5
generate_eta(method = "exponential", n = 10, max_eta = 5)
#> [1] 0.00000000 0.03374245 0.09002825 0.18391863 0.34053721 0.60179276
#> [7] 1.03759328 1.76455236 2.97719318 5.00000000
# Generate 5 linearly spaced eta values up to 3
generate_eta(method = "linear", n = 5, max_eta = 3)
#> [1] 0.00 0.75 1.50 2.25 3.00