Title: | Make Better Financial Decisions |
---|---|
Description: | Make informed, data-driven decisions for your personal or household finances. Use tools and methods that are selected carefully to align with academic consensus, bridging the gap between theoretical knowledge and practical application. They assist you in finding optimal asset allocation, preparing for retirement or financial independence, calculating optimal spending, and more. |
Authors: | Kamil Wais [aut, cre, cph, fnd] , Olesia Wais [aut] |
Maintainer: | Kamil Wais <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9025 |
Built: | 2024-12-17 06:30:48 UTC |
Source: | https://github.com/R4GoodAcademy/R4GoodPersonalFinances |
Calculates the optimal allocation to the risky asset using the Merton Share formula.
calc_optimal_risky_asset_allocation( risky_asset_return_mean, risky_asset_return_sd, safe_asset_return, risk_aversion )
calc_optimal_risky_asset_allocation( risky_asset_return_mean, risky_asset_return_sd, safe_asset_return, risk_aversion )
risky_asset_return_mean |
A numeric. The expected (average) yearly return of the risky asset. |
risky_asset_return_sd |
A numeric. The standard deviation of the yearly returns of the risky asset. |
safe_asset_return |
A numeric. The expected yearly return of the safe asset. |
risk_aversion |
A numeric. The risk aversion coefficient. |
Can be used to calculate the optimal allocation to the risky asset for vectors of inputs.
A numeric.
The optimal allocation to the risky asset.
In case of NaN()
(because of division by zero)
the optimal allocation to the risky asset is set to 0.
Haghani V., White J. (2023) "The Missing Billionaires: A Guide to Better Financial Decisions." ISBN:978-1-119-74791-8.
calc_optimal_risky_asset_allocation( risky_asset_return_mean = 0.05, risky_asset_return_sd = 0.15, safe_asset_return = 0.02, risk_aversion = 2 ) calc_optimal_risky_asset_allocation( risky_asset_return_mean = c(0.05, 0.06), risky_asset_return_sd = c(0.15, 0.16), safe_asset_return = 0.02, risk_aversion = 2 )
calc_optimal_risky_asset_allocation( risky_asset_return_mean = 0.05, risky_asset_return_sd = 0.15, safe_asset_return = 0.02, risk_aversion = 2 ) calc_optimal_risky_asset_allocation( risky_asset_return_mean = c(0.05, 0.06), risky_asset_return_sd = c(0.15, 0.16), safe_asset_return = 0.02, risk_aversion = 2 )
Calculates changes in purchasing power over time, taking into account the real interest rate.
calc_purchasing_power(x, years, real_interest_rate)
calc_purchasing_power(x, years, real_interest_rate)
x |
A numeric. The initial amount of money. |
years |
A numeric. The number of years. |
real_interest_rate |
A numeric. The yearly real interest rate. |
The real interest rate is the interest rate after inflation. If negative (e.g. equal to the average yearly inflation rate) it can show diminishing purchasing power over time. If positive, it can show increasing purchasing power over time, and effect of compounding interest on the purchasing power.
A numeric. The purchasing power.
calc_purchasing_power(x = 10, years = 30, real_interest_rate = -0.02) calc_purchasing_power(x = 10, years = 30, real_interest_rate = 0.02)
calc_purchasing_power(x = 10, years = 30, real_interest_rate = -0.02) calc_purchasing_power(x = 10, years = 30, real_interest_rate = 0.02)
Calculates the risk adjusted return for portfolio of given allocation to the risky asset.
calc_risk_adjusted_return( safe_asset_return, risky_asset_return_mean, risky_asset_allocation, risky_asset_return_sd = NULL, risk_aversion = NULL )
calc_risk_adjusted_return( safe_asset_return, risky_asset_return_mean, risky_asset_allocation, risky_asset_return_sd = NULL, risk_aversion = NULL )
safe_asset_return |
A numeric. The expected yearly return of the safe asset. |
risky_asset_return_mean |
A numeric. The expected (average) yearly return of the risky asset. |
risky_asset_allocation |
A numeric.
The allocation to the risky asset. Could be a vector.
If it is the optimal allocation then parameters
|
risky_asset_return_sd |
A numeric. The standard deviation of the yearly returns of the risky asset. |
risk_aversion |
A numeric. The risk aversion coefficient. |
A numeric. The risk adjusted return.
Haghani V., White J. (2023) "The Missing Billionaires: A Guide to Better Financial Decisions." ISBN:978-1-119-74791-8.
calc_risk_adjusted_return( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_return_sd = 0.15, risky_asset_allocation = 0.5, risk_aversion = 2 ) calc_risk_adjusted_return( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_allocation = c(0.25, 0.5, 0.75), risky_asset_return_sd = 0.15, risk_aversion = 2 )
calc_risk_adjusted_return( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_return_sd = 0.15, risky_asset_allocation = 0.5, risk_aversion = 2 ) calc_risk_adjusted_return( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_allocation = c(0.25, 0.5, 0.75), risky_asset_return_sd = 0.15, risk_aversion = 2 )
Plots the effect of real interest rates (positive or negative) on the purchasing power of savings over the span of 50 years (default).
plot_purchasing_power( x, real_interest_rate, years = 50, legend_title = "Real interest rate", seed = NA )
plot_purchasing_power( x, real_interest_rate, years = 50, legend_title = "Real interest rate", seed = NA )
x |
A numeric. The initial amount of money. |
real_interest_rate |
A numeric. The yearly real interest rate. |
years |
A numeric. The number of years. |
legend_title |
A character. |
seed |
A numeric. Seed passed to |
A ggplot2::ggplot()
object.
plot_purchasing_power( x = 10, real_interest_rate = seq(-0.02, 0.04, by = 0.02) )
plot_purchasing_power( x = 10, real_interest_rate = seq(-0.02, 0.04, by = 0.02) )
Plots the risk adjusted returns for portfolios of various allocations to the risky asset.
plot_risk_adjusted_returns( safe_asset_return, risky_asset_return_mean, risky_asset_return_sd, risk_aversion = 2, current_risky_asset_allocation = NULL )
plot_risk_adjusted_returns( safe_asset_return, risky_asset_return_mean, risky_asset_return_sd, risk_aversion = 2, current_risky_asset_allocation = NULL )
safe_asset_return |
A numeric. The expected yearly return of the safe asset. |
risky_asset_return_mean |
A numeric. The expected (average) yearly return of the risky asset. |
risky_asset_return_sd |
A numeric. The standard deviation of the yearly returns of the risky asset. |
risk_aversion |
A numeric. The risk aversion coefficient. |
current_risky_asset_allocation |
A numeric. The current allocation to the risky asset. For comparison with the optimal allocation. |
A ggplot2::ggplot()
object.
Haghani V., White J. (2023) "The Missing Billionaires: A Guide to Better Financial Decisions." ISBN:978-1-119-74791-8.
plot_risk_adjusted_returns( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_return_sd = 0.15, risk_aversion = 2, current_risky_asset_allocation = 0.8 )
plot_risk_adjusted_returns( safe_asset_return = 0.02, risky_asset_return_mean = 0.04, risky_asset_return_sd = 0.15, risk_aversion = 2, current_risky_asset_allocation = 0.8 )
Wrapper functions for printing nicely formatted values.
print_currency( x, suffix = "", big.mark = ",", accuracy = NULL, prefix = NULL, ... ) print_percent(x, accuracy = 0.1, ...)
print_currency( x, suffix = "", big.mark = ",", accuracy = NULL, prefix = NULL, ... ) print_percent(x, accuracy = 0.1, ...)
x |
A numeric vector |
big.mark |
Character used between every 3 digits to separate thousands. |
accuracy |
A number to round to. Use (e.g.) Applied to rescaled data. |
prefix , suffix
|
Symbols to display before and after value. |
... |
Other arguments passed on to |
print_currency(2345678, suffix = " PLN") print_percent(0.52366)
print_currency(2345678, suffix = " PLN") print_percent(0.52366)
Run a package app
run_app( which = c("risk-adjusted-returns", "purchasing-power"), res = 120, shinylive = FALSE )
run_app( which = c("risk-adjusted-returns", "purchasing-power"), res = 120, shinylive = FALSE )
which |
A character. The name of the app to run. Currently available:
|
res |
A numeric. The initial resolution of the plots. |
shinylive |
A logical. Whether to use |