Title: | Develop Actuarial Models |
---|---|
Description: | Actuarial reports are prepared for the last day of a specific period, such as a month, a quarter or a year. Actuarial models assume that certain events happen at the beginning or end of periods. The package contains functions to easily refer to the first or last (working) day within a specific period relative to a base date to facilitate actuarial reporting and to compare results. |
Authors: | Zuzanna Chmielewska [aut, cre]
|
Maintainer: | Zuzanna Chmielewska <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.1 |
Built: | 2025-02-17 05:46:39 UTC |
Source: | https://github.com/cran/actuaryr |
Creates an object of class ircurve which represents in interest rates curve. The curve cosists of interest rates and is of type either "forward" or "spot". The interest rates curve can be for monthly or yearly periods.
as_ircurve(rates = double(), type = "forward", period = "year")
as_ircurve(rates = double(), type = "forward", period = "year")
rates |
vector of rates |
type |
"forward" or "spot" |
period |
"year" or "month" |
Interest rates curve, an object of class ircurve.
as_ircurve(c(0.01, 0.015)) as_ircurve(c(0.002, 0.001), type = "spot", period = "month")
as_ircurve(c(0.01, 0.015)) as_ircurve(c(0.002, 0.001), type = "spot", period = "month")
Changes the period of an interest rates curve (object of class ircurve) from year to monthl or vice versa.
change_period(ircurve, to)
change_period(ircurve, to)
ircurve |
an object of class ircurve |
to |
"year" or "month" |
An object of class ircurve with changed type.
my_ircurve <- as_ircurve(rep(0.01, 12), period = "month") change_period(my_ircurve, to = "year")
my_ircurve <- as_ircurve(rep(0.01, 12), period = "month") change_period(my_ircurve, to = "year")
Changes the type of an interest rates curve (object of class ircurve) from forward to spot or vice versa.
change_type(ircurve, to)
change_type(ircurve, to)
ircurve |
an object of class ircurve |
to |
"forward" or "spot" |
An object of class ircurve with changed type.
my_ircurve <- as_ircurve(c(0.1, 0.2, 0.3), type = "spot") change_type(my_ircurve, to = "forward")
my_ircurve <- as_ircurve(c(0.1, 0.2, 0.3), type = "spot") change_type(my_ircurve, to = "forward")
Returns the effect of comparison of the two tables. It gets common columns and number of rows of the two tables. In case of type mismatches, it coerces the weaker type into a stronger type. The output contains the absolute difference for numerical values and the_same/different for characters.
compare(x, y)
compare(x, y)
x |
the first data frame |
y |
the second data frame |
data frame
x <- data.frame( a = rep(1, 3), b = rep(2, 3) ) y <- data.frame( a = rep(2, 3), b = rep(2, 3) ) compare(x, y)
x <- data.frame( a = rep(1, 3), b = rep(2, 3) ) y <- data.frame( a = rep(2, 3), b = rep(2, 3) ) compare(x, y)
Returns the first day of a month in reference to the base date.
dref_fdom(date)
dref_fdom(date)
date |
base date in format YYYY-MM-DD |
date
dref_fdom("2020-09-21")
dref_fdom("2020-09-21")
Returns the first day of a quarter in reference to the base date.
dref_fdoq(date)
dref_fdoq(date)
date |
base date in format YYYY-MM-DD |
date
dref_fdoq("2020-09-21")
dref_fdoq("2020-09-21")
Returns the first day of a year in reference to the base date.
dref_fdoy(date)
dref_fdoy(date)
date |
base date in format YYYY-MM-DD |
date
dref_fdoy("2020-09-21")
dref_fdoy("2020-09-21")
Returns the first working day of a month in reference to the base date.
dref_fwdom(date)
dref_fwdom(date)
date |
base date in format YYYY-MM-DD |
date
dref_fwdom("2020-11-21")
dref_fwdom("2020-11-21")
Returns the first working day of a quarter in reference to the base date.
dref_fwdoq(date)
dref_fwdoq(date)
date |
base date in format YYYY-MM-DD |
date
dref_fwdoq("2020-09-21")
dref_fwdoq("2020-09-21")
Returns the first working day of a year in reference to the base date.
dref_fwdoy(date)
dref_fwdoy(date)
date |
base date in format YYYY-MM-DD |
date
dref_fwdoy("2022-09-21")
dref_fwdoy("2022-09-21")
Returns the last day of a month in reference to the base date.
dref_ldom(date)
dref_ldom(date)
date |
base date in format YYYY-MM-DD |
date
dref_ldom("2020-09-21")
dref_ldom("2020-09-21")
Returns the last day of a month in reference to the base date.
dref_ldoq(date)
dref_ldoq(date)
date |
base date in format YYYY-MM-DD |
date
dref_ldoq("2020-09-21")
dref_ldoq("2020-09-21")
Returns the last day of a year in reference to the base date.
dref_ldoy(date)
dref_ldoy(date)
date |
base date in format YYYY-MM-DD |
date
dref_ldoy("2020-09-21")
dref_ldoy("2020-09-21")
Returns the last working day of a month in reference to the base date.
dref_lwdom(date)
dref_lwdom(date)
date |
base date in format YYYY-MM-DD |
date
dref_lwdom("2020-10-21")
dref_lwdom("2020-10-21")
Returns the last working day of a quarter in reference to the base date.
dref_lwdoq(date)
dref_lwdoq(date)
date |
base date in format YYYY-MM-DD |
date
dref_lwdoq("2020-09-21")
dref_lwdoq("2020-09-21")
Returns the last working day of a year in reference to the base date.
dref_lwdoy(date)
dref_lwdoy(date)
date |
base date in format YYYY-MM-DD |
date
dref_lwdoy("2022-09-21")
dref_lwdoy("2022-09-21")
Returns the last day of the previous month.
dref_mtd(date)
dref_mtd(date)
date |
base date in format YYYY-MM-DD |
date
dref_mtd("2020-09-21")
dref_mtd("2020-09-21")
Returns the last day of the previous quarter.
dref_qtd(date)
dref_qtd(date)
date |
base date in format YYYY-MM-DD |
date
dref_qtd("2020-09-21")
dref_qtd("2020-09-21")
Returns the last day of the previous year.
dref_ytd(date)
dref_ytd(date)
date |
base date in format YYYY-MM-DD |
date
dref_ytd("2020-09-21")
dref_ytd("2020-09-21")
Print ircurve
## S3 method for class 'ircurve' print(x, ...)
## S3 method for class 'ircurve' print(x, ...)
x |
an object of class ircurve |
... |
further arguments passed to or from other methods |
Prints the interest rates curve.
my_ircurve <- as_ircurve(c(0.022, 0.018)) print(my_ircurve)
my_ircurve <- as_ircurve(c(0.022, 0.018)) print(my_ircurve)