fin_interest: Compute the value of a principal & annual deposits at a...

fin_interestR Documentation

Compute the value of a principal & annual deposits at a compound interest over a number of years

Description

Allows you to determine the final value of an initial principal (with optional periodic deposits), over a number of years (yrs) at a given rate of interest. Principal and deposits are optional. You control compounding periods each year (n) and whether deposits occur at the beginning or end of the year. The function outputs a nice table of annual returns, formats the total using a user-settable currency symbol. Can also report using a web table.

notes: Graham valuation: fair P/E = 9 + (1.5 * growth%). e.g. $INTEL fair P/E = 9+.53 = 10.5 up to 9+210 = 29 Can move the weighting between a conservative .5 and an optimistic 2 (in terms of how long the growth will last and how low the hurdle rate is)

Usage

fin_interest(
  principal = 0,
  deposits = 0,
  inflate = 0,
  interest = 0.05,
  yrs = 10,
  final = NULL,
  n = 12,
  when = "beginning",
  symbol = NULL,
  largest_with_cents = 0,
  baseYear = as.numeric(format(Sys.time(), "%Y")),
  table = TRUE,
  report = c("markdown", "html")
)

Arguments

principal

The initial investment at time 0.

deposits

Optional periodic additional investment each year.

inflate

How much to inflate deposits over time (default = 0)

interest

Annual interest rate (default = .05)

yrs

Duration of the investment (default = 10).

final

if set (default = NULL), returns the rate required to turn principal into final after yrs (principal defaults to 1)

n

Compounding intervals per year (default = 12 (monthly), 365 for daily)

when

Deposits made at the "beginning" (of each year) or "end"

symbol

Currency symbol to embed in the result.

largest_with_cents

Default = 0

baseYear

Default = current year (for table row labels)

table

Whether to print a table of annual returns (default TRUE)

report

"markdown" or "html",

Value

  • Value of balance after yrs of investment.

References

See Also

  • umx_set_dollar_symbol(), fin_percent(), fin_NI(), fin_valuation()

Other Miscellaneous Functions: deg2rad(), fin_JustifiedPE(), fin_NI(), fin_percent(), fin_ticker(), fin_valuation(), rad2deg(), umxBrownie()

Examples

## Not run: 
# 1. Value of a principal after yrs years at 5% return, compounding monthly.
# Report in browser as a nice table of annual returns and formatted totals.
fin_interest(principal = 5000, interest = 0.05, rep= "html")

## End(Not run)

# Report as a nice markdown table
fin_interest(principal = 5000, interest = 0.05, yrs = 10)

umx_set_dollar_symbol("£")
# 2 What rate is needed to increase principal to final value in yrs time?
fin_interest(final = 1.4, yrs=5)
fin_interest(principal = 50, final=200, yrs = 5)

# 3. What's the value of deposits of $100/yr after 10 years at 7% return?
fin_interest(deposits = 100, interest = 0.07, yrs = 10, n = 12)

# 4. What's the value of $20k + $100/yr over 10 years at 7% return?
fin_interest(principal= 20e3, deposits= 100, interest= .07, yrs= 10, symbol="$")

# 5. What is $10,000 invested at the end of each year for 5 years at 6%?
fin_interest(deposits = 10e3, interest = 0.06, yrs = 5, n=1, when= "end")

# 6. What will $20k be worth after 10 years at 15% annually (n=1)?
fin_interest(deposits=20e3, interest = 0.15, yrs = 10, n=1, baseYear=1)
# $466,986

# manual equivalent
sum(20e3*(1.15^(10:1))) # 466985.5

# 7. Annual (rather than monthly) compounding (n=1)
fin_interest(deposits = 100, interest = 0.07, yrs = 10, n=1)

# 8 Interest needed to increase principal to final value in yrs time.
fin_interest(principal = 100, final=200, yrs = 5)


umx documentation built on May 29, 2024, 5:40 a.m.