Description Usage Arguments Details Value References Examples
Compute compound interest for a given number of periods, compounding with an indicated frequency per period.
1 2 3 | compoundInterest(interest,periods=1,frequency=1,net.value=FALSE)
simple2logReturns(R)
|
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) |
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.)
vector of the length of the longest argument.
Ruey Tsay (2005) Analysis of Financial Time Series, 2nd ed. (Wiley, p. 6)
1 2 3 4 5 6 7 8 | # "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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.