Description Usage Format Value Methods Examples
Class providing a ratchet payoff object. The payoff will be the highest account value recorded at some specified times.
1 |
R6Class
object.
Object of R6Class
new
Initialize method. The arguments are a non negative scalar with the premium and the ratchet frequency. Allowed units for the frequency are "m" for 4 weeks, "w" for weeks, "d" for days
set_premium
Stores the premium in a private field. The argument is a non negative scalar
get_premium
Returns the premium as non negative scalar
set_freq
Sets the ratchet frequency. Allowed units for the frequency are "m" for 4 weeks, "w" for weeks, "d" for days
get_payoff
Gets the payoff.
The arguments are a numeric
vector
with the amounts, a vector of timeDate
objects
with the start and end dates for the ratchet and a numeric
vector with the account values. (see Examples)
1 2 3 4 5 6 7 | freq <- "1m"
premium <- 100
ratchet <- payoff_ratchet$new(premium, freq)
t1 <- timeDate::timeDate("2016-01-01")
t2 <- timeDate::timeDate("2016-12-31")
account <- 120 * rnorm(365)
ratchet$get_payoff(c(120,100), c(t1,t2), account)
|
Loading required package: orthopolynom
Loading required package: polynom
[1] 210.2018 210.2018
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.