This version improve the performance of portfolio optimization algorithms,
ability to parallelize the Monte Carlo simulations, and simulation caching.
It brings also new useful functions as render_scenario_snapshot(), plot_future_saving_rates(), and get_default_gompertz_parameters().
With render_scenario_snapshot() function, it is possible to get a table with cash flow and net worth statements for a given year in a simulated scenario.
The result of new features in this version can be seen in the blog post: Can Juliet manage without Romeo? How much she should spend, save, and invest to achieve that?.
NLOPT_LD_SLSQP
(Sequential Least-Squares Quadratic Programming). The optimization is no more robust and faster. opts list to simulate_scenario() function with optimization parameters nloptr optimization function and thus changing algorithm or its options. The list of possible options and their default values can be obtain with nloptr::nloptr.print.options(). simulate_scenario() function to reproduce the same results for the same scenario, also for Monte Carlo samples.auto_parallel argument to simulate_scenario() function to automatically parallelize the Monte Carlo simulations.use_cache argument in simulate_scenarios() function
to caching also all data of all Monte Carlo samples for a scenario (not only each sample separately). plot_scenarios() which does not reorder scenarios anymore.render_scenario_snapshot() function to render a table with cash flow and net worth statements for a given year (first by default) in a simulated scenario.plot_future_saving_rates() for plotting the future saving rates.Household and HouseholdMember objects.plot_expected_allocation().age() function as convenient wrapper for getting age of a household member when defining triggers for expected income or spending streams.get_default_gompertz_parameters() function to get default parameters for the Gompertz model for a given country, sex, and age.This major release introduces probably first in the world (open-sourced) implementation of a new multilevel life-cycle modeling of a household finances. It connects life-cycle models with single-period net-worth Markowitz optimization models and allows for high degree of personalization. The implementation is based on a novel theoretical framework, described by Thomas M. Idzorek and Paul D. Kaplan in "Lifetime Financial Advice: A Personalized Optimal Multilevel Approach" (2024).
Household R6 class that aggregates information about a household
and its members and HouseholdMember class that aggregates information
about a single member of a household.set_cache(), reset_cache() and get_cache().calc_life_expectancy() function to calculate the life expectancy of a person based on the Gompertz model.plot_life_expectancy() function to visualize the probability of dying and life expectancy of every member of a Household object and similar plot_survival() function for visualizing the probability of survival of each of the members of a Household and the probability of at least one member of a Household to survive.create_portfolio_template() function to create an exemplary Portoflio object - a template for default portfolio with two asset classes: GlobalStocksIndexFund and InflationProtectedBonds and with some reasonable default values that should be updated and customised further.calc_portfolio_parameters() function to calculate the parameters of a Portfolio object like current value, weights of assets, expected return and standard deviation of the whole portfolio.calc_optimal_asset_allocation() function to calculate optimal allocation for a particular Household and Portfolio objects.plot_optimal_portfolio() function to visualize the current and optimal allocation to assets for a particular Portfolio object.simulate_scenario() function to simulate a single scenario of cash flows for a particular Household and Portfolio objects using expected returns of the assets in portfolio or random returns in multiple Monte Carlo samples.simulate_scenarios() function to simulate multiple scenarios of cash flows for a particular Household and Portfolio objects. The scenarios parameters can triggered by different events like different years of retirement.plot_scenarios() function to visualize the scenarios metrics that help with choosing the optimal parameters for the best scenario, e.g. the optimal year for retirement.plot_expected_allocation() function to visualize the expected allocation of assets for a particular scenario over the household life cycle.plot_expected_capital() function to visualize the expected financial, human, and total capital, as well as liabilities for a particular scenario over the household life cycle.plot_future_income() and plot_future_spending() functions to visualize the future income and spending for a particular scenario over the household life cycle. The plot_future_spending() function allows to plot the relation of discretionary and non-discretionary spending, structure of non-discretionary spending and possible levels of discretionary spending over time based on Monte Carlo simulations.This release provides functions for calculating probability of retirement ruin and functions for calibrating the underlying Gompertz model with the use of the mortality rates.
calc_retirement_ruin() and plot_retirement_ruin() to calculate and visualize the probability of retirement ruin.retirement-ruin option to run_app() function for
running package new interactive app.calc_gompertz_survival_probability() to calculate the probability of survival using the Gompertz model. calc_gompertz_parameters() to calculate the parameters of the Gompertz model based on mortality rates and calc_gompertz_joint_parameters() to calculate the parameters of the joint Gompertz model.plot_gompertz_calibration() for visually checking the calibration of the Gompertz model and plot_joint_survival() for plotting the survival probabilities for two individuals and their joint survival probability.read_hmd_life_tables() for reading the 'Human Mortality Database' (HMD) life tables files.Initial release of the package includes functions designed to support the optimal allocation of your investment portfolio with the use of the 'Merton Share' formula.
calc_purchasing_power() and plot_purchasing_power() to calculate and visualize the effect of real interest rates—whether positive (compounding) or negative (inflation)—on the purchasing power of savings. calc_optimal_risky_asset_allocation() for calculating optimal allocation using the 'Merton Share' formula. calc_risk_adjusted_return() and plot_risk_adjusted_returns() to calculate and visualize the effect of allocation to risky assets on the risk-adjusted return.run_app() function that runs package interactive apps:
risk-adjusted-returns and purchasing-power.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.