miraisolutions / SmaRP

Shiny app for projecting retirement funds / benefits
https://mirai-solutions.ch/gallery/smarp
20 stars 9 forks source link
pension r retirement shiny

SmaRP: Smart Retirement Planning

Smart Retirement Planning (SmaRP) is a Mirai Solutions initiative designed to guide people working in Switzerland towards a strategic decision-making process for their retirement.

SmaRP is based on the Swiss pension system and reflects the complexity of its legal framework. It is implemented as an R Shiny pension calculator web app, in the form of an R package. The app features a flexible yet intuitive user interface with detailed personalization parameters and options. This allows to interactively compute and display the evolution of the retirement funds over time, split into their contributing components. A report including details regarding calculation methodology and approximations can be generated and downloaded.

Thanks to the open-source nature of the project, the underlying assumptions and calculations are fully disclosed. Unlike other pension calculators, this makes results transparent, comparable, and reproducible.

Using SmaRP

The SmaRP Shiny app is deployed to Google Cloud Platform (using Docker containers) and can be accessed at https://mirai-solutions.ch/gallery/smarp.

SmaRP is developed using a GitFlow approach, where the master branch always reflects the latest release of the live app, whereas branch develop collects the latest delivered developments for the next releases.

The R package SmaRP for the latest release can be installed from GitHub with

remotes::install_github("miraisolutions/SmaRP@master", build_opts = "")

whereas the development version can be installed via

remotes::install_github("miraisolutions/SmaRP@develop", build_opts = "")

Then, the installed package can be used to serve the app locally from R via

SmaRP::launch_application()

Note that SmaRP is deployed using version-stable images from the Rocker project. The target environment of the live app is currently bound to R 3.5.3. Therefore, the app is developed and tested with the corresponding version of R and packages, as opposed to the latest available versions. This is made easy by the containerized approach to align version-stable development and deployment environments described in our techguides.

Details and key features

The evolution of the total retirement fund over time is computed by projecting the value of the occupational fund (2nd Pillar), the private fund (3rd Pillar) and the tax relief, thus deriving their contributions at the desired retirement age.

Results of the calculation are available in SmaRP in 3 different ways:

  1. a graph showing the projected funds over time until retirement
  2. a table with details about projected quantities (also available for download)
  3. a downloadable PDF report including detailed explanations of the calculation methodology and inputs.

Assumptions and limitations

Source code

Core calculations behind this Shiny app have been implemented via several functions, collected in the main source files SmaRP/R/core.R and SmaRP/R/TaxBenefits.R.

Documentation for the relevant exported functions used in the app is also provided and can be browsed via

help(package = "SmaRP")

On a functional level, the code is covered by extensive unit tests.

The source code for the app itself is available under SmaRP/inst/application.

Data sources and references

SmaRP reflects the Swiss pension system and uses corresponding legal parameters and data. An overview of these components can be found at e.g. https://en.wikipedia.org/wiki/Pension_system_in_Switzerland. A more detailed explanation is available on the Swiss Federal Social Insurance Office website (in German).

Legal parameters in SmaRP are defined in SmaRP/inst/application/global.R, whereas data is stored under SmaRP/inst/application/data.

Accuracy

While SmaRP was developed under the utmost care and diligence, Mirai Solutions does not guarantee for its accuracy and correctness. In addition, SmaRP is based on assumptions and projections (explained in a section above and in the PDF report) and as such computed figures should be understood as general references and do not hold any legal value.

Besides standard unit tests at the functional level, results from the SmaRP web app have been checked against other online free sources for second, third Pillars and tax calculators.

To keep testing and improving SmaRP, we encourage users to get back to us! Your feedback is always highly appreciated. You can use the issue tracker on GitHub to suggest enhancements or report problems, and reach out via email at info@mirai-solutions.com for any questions and comments.