compoundInterest: Compute compound interest

compoundInterestR Documentation

Compute compound interest

Description

Compute compound interest for a given number of periods, compounding with an indicated frequency per period.

Usage

compoundInterest(interest, periods = 1, frequency = 1, net.value = FALSE)

simple2logReturns(R)

Arguments

interest

rate of interest per period (usually per year).

periods

number of periods over which to compound.

frequency

number of times per period to compound; frequency = Inf to convert simple to log returns.

net.value

if TRUE, return the total value per unit invested; otherwise return net increase = (net value - 1).

R

simple interest to be converted to log(returns).

Details

These functions are vectorized for all arguments. The code uses optionally expm1(x) = exp(x) - 1 and log1p(x) = log(1+x) which can preserve numerical precision for x very close to 0.

Value

vector of the length of the longest argument.

References

Ruey Tsay (2005) Analysis of Financial Time Series, 2nd ed. (Wiley, p. 6)

Examples

# "Net Value" column of Tsay Table 1.1, p. 4
compoundInterest(0.1, frequency = c(1, 2, 4, 12, 52, 365, Inf),
                      net.value = FALSE)
# Example 1.1, p. 6
compoundInterest(.0446, freq = Inf)
# Inverse of Example 1.1
simple2logReturns(.0456)

FinTS documentation built on May 29, 2024, 4:24 a.m.