Coder Social home page Coder Social logo

boknows / cfiresim-open Goto Github PK

View Code? Open in Web Editor NEW
153.0 153.0 52.0 464 KB

An attempt to re-write the popular retirement calculator (cFIREsim.com) in mainly javascript, and begin the journey toward open-source.

License: Apache License 2.0

HTML 19.81% PHP 33.13% JavaScript 47.06%

cfiresim-open's People

Contributors

boknows avatar breadtk avatar britgamer avatar doozan avatar jchristian avatar jonasle avatar pmallory avatar sbine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cfiresim-open's Issues

Percent of Portfolio missing ceiling/floor options

I completely missed this until someone reviewed it. The Percent of Portfolio spending method should always have a floor/ceiling available, not just if you change the "percentage type".

I believe that the dropdowns in the form should be reworked to be closer to the legacy code, and the spending method itself needs to be adjusted to accept floor/ceiling for this whole spending method. I'm guessing that taking about "percentage type" altogether would be the best path.

Discrepancy between old and new cFIREsim results.

When I use the same simulation values for simulations in the old and new sites I get significantly different results.

  • old site = 69% success
  • new site 97% success

Simulation values:

  • $541K starting amount
  • 80% stocks
  • 10% bonds
  • 10% gold
  • retire 2018 - 2060
  • pension 1: $8K starting 2029
  • pension 2: $8.9K starting 2034
  • extra income/savings: $30K starting 2016 ending 2017
  • variable spending: $30K - $50K starting at $40K with Z = 0.5

Non-recurring income/spending not working

When selecting "Non-recurring" as "false", for either Income or Spending, those numbers do not show up in the "Portfolio Adjustments", or anywhere in the simulation.

Start years beyond 2015 are not showing chart values

If you put any "Retirement Start Year" in the future, the chart is blank. Initial research shows that the variable infAdjSpending is showing up as NaN and spending as "undefined" in the years before retirement, probably causing an error parsing into a chart.

Download CSV button not functioning

This button needs to be at the top right of a given output page, and must open a download dialog. Currently there is an issue with it not functioning as a . Change it to an within a

Styling of "Run Simulation" button

This button needs to be bolder, and probably colored. We also need to find a good place for it in the top-right of the screen, so that people don't need to scroll down all the way (necessarily) to press it.

Complete Statistics

avgPortfolioAtRetirement and successRate are currently null. Make sure that all stats from legacy cFIREsim are included.

Results tab incorrect or misleading as to portfolio pull down.

Example test portfolio:

$1,000,000 portfolio.
$50,000 SS income.
$60,000 yearly spend, inflation adjusted.

This is the Withdrawal Analysis
<
1st 5y : 1-10 : 11-20 : 21-30
Average: $60,000 $55,000 $60,000 $60,000
Median: $60,000 $60,000 $60,000 $60,000
St. Dev.: $0 $16,583 $0 $0
Highest: $60,000 $60,000 $60,000 $60,000
Lowest: $60,000 $0 $60,000 $60,000
Failures: 0 0 0 0

These numbers make no sense to me. Perhaps I don't understand what the number represents.

Ignoring inflation, I only need to spend $10,000 from the portfolio to make the $60,000 target.
So, numbers in the $55,000 to $60,000 range make no sense if it's total spending amount. I can't imagine I would ever have to drop down below the target $60,000 spending target given this scenario.

If the amount instead refers to how much I would be pulling from the portfolio to reach my spending target, again, numbers in the $55,000 to $60,000 range make no sense.

I can't figure out any other likely meanings for this number.

Is this a defect or am I just clueless?

Thanks!

Recreate Investigate "Maximum initial yearly spending"

cFIREsim legacy had an option to investigate what the maximum initial starting spending value would be given a user inputted minimum success rate. The simulation would vary the initial spending and track the success rate until it came up with a maximum number.

We must recreate this feature.

Targeted Assets section

When the 'Equities' field in the target section is updated, the 'Gold' field is set to the same value. The same problem exists for the 'Bonds' and 'Cash' field.

Spending graph off by fractions of cents

I made a design decision to show the Yearly Spending graph no matter what the spending method chosen. In doing so, I found that the default values (Inflation Adjusted Spending, 40k spending) give a graph that is not exactly $40k/yr. It appears to fluctuate up/down by $0.01. This is likely due to a rounding issue.

Pensions that are not inflation adjusted are breaking Stats

Adding a pension and selecting "false" for inflation adjusted, seems to break the simulation in a few different ways. The graph shows a big discontinuity and the stats are zero in a lot of places.

Check to see if this also occurs with Savings/Spending that are not inflation adjusted.

Sim results capped at 10, can't close result tabs

While investigating different scenarios, I'll often run a single scenario, and tweak the inputs to see how it affects the result. After running 10 of these test scenarios, no new results are produced, and I have to close down the browser tab to reset the results. Allowing the user to right-click on a results tab and close that tab would be helpful.

Recreate Help/Tutorial

Ideally, this would be done by using a copy of the current input.php, and adding step-by-step popup jquery tooltips to show how to walk through a scenario. For instance, you load a popup modal that states the following scenario "A couple is 40, and is aiming for 10 more years of savings. They save $10,000/yr in a 401k, and $11,000 in an IRA. Their expected SS is $____. Their spending is $_____." Each step of the way, it will show the user what to enter and where.

This should be modelled for several scenarios that all end up using the different things cFIREsim has to offer. ie: A scenario where someone is paying for kids college down the road, a scenario where someone lowers expenses half-way through the sim, a scenario where they use variable spending, etc.

login button does not work

I get redirected to http://www.cfiresim.com/phpBB3/login.php and the password I used to use no longer works. I can't get a recovery email sent, it says no account is found with the account I used to use.

Forum appears to be hacked - all of the boards are locked except one, and the top thread in the only unlocked forum is porn.

portfolio.start for a given year

Portfolio.start should actually be the value: portfolio = portfolio - this.sim[i][j].spending + sumOfAdjustments;

This is in calcMarketGains(). After that line it should read:
this.sim[i][j].portfolio.start = portfolio;

Possible simulation calculation issues

User submitted a scenario in which they had a 50/50 stock/bond portfolio of $2.5M, with $70k/yr spending, and a period from 2015-2070. This resulted in a maximum portfolio of over $1.5B (compared to a maximum of $30M in legacy cFIREsim).

Double check the bond calculation, how inflation is added, and other possible variables... specifically with that 1 errant $1.5B cycle.

Add mouseover info for output tabs

In the legacy cFIREsim, each new simulation opened a new browser tab and that tab had a short summary of that simulation (G-K Spending, $1,000,000 Port / $40k Spend) etc.

In cFIREsim-open, the output is opened inside of a modal popup, which has a Twitter Bootstrap tab attached. We must add some identifying information for each simulation at the top of each output tab, and/or as a mouseover on the tab itself. This will provide better recognition and allow people to compare simulations easier.

VPW Spending Method shoots past zero

If there is a defined spending floor present, some of the VPW cycles will run past $0 in portfolio. VPW, by definition, tries to hit $0 exactly.

Guyton Klinger Portfolio Management Rule Ignored

Hi,

I believe there is a piece missing from the Guyton Klinger simulations. I don't know if this is related, but in the legacy cFIREsim it was labeled "Guyton-Klinger Method (simplified)". I suspect that the current cFIREsim is still using a simplified version.

So... I think this may be two issues really.

  1. Can we put a "simplified" tag on the Guyton-Klinger calculation on the current version? Maybe with help text explaining what is actually missing.
  2. Can we implement the actual GK calculation? The piece I believe is missing is what is called the Portfolio Management Rule original paper or simpler which states that you move portfolio growth (in years that it happens) into cash every year, and you fund future withdrawals from that.

I would be happy to work on (2). I don't know how quickly it will happen, particularly since I think the reason it hasn't happened yet is that the code isn't factored to accommodate this kind of thing.

Regards,
M

Error checking for SumOfAdjustments

Work on the logic for SumOfAdjustments. If pensions/SS/extra-income for a given year is greater than the required spending, nothing should actually be "taken out" of the portfolio. This logic should reflect that.

cFIREsim legacy logic: Add/remove SumOfAdjustments from portfolio before calculating market gains.
cFIREsim open current logic: Add/remove SumOfAdjustments after market gains.

Spending Floor not activating in first 5 years of CAPE spending method

Test case: Default values for all. Select CAPE spending. Change CAPE modifier to 0.6. Set Defined Spending Floor of $35000.

You'll see that in the first 5 years of a few simulation cycles that the spending gets below $35000. I think it's only happening in the data used in the 1800s, which indicates that there is an issue when the CAPE data is missing (those first 10 years?).

Statistics based on all years, not just retirement

Many of the stats, if not all, are based on all of the years of a simulation and probably should only include years in retirement. For example, if you choose 2020 as a retirement date, the Withdrawal Analysis table will show that you spent $0 on average in the "First 5 years" section. True, you spent $0 in the first 5 years of the simulation... but not the first 5 years of retirement.

Also, the Spending graph represents spending during all of the simulation, and not just retirement. So, for future retirement dates, it shows a long period of $0 spending before shooting up to the normal spending level. I think that we should probably leave it like that, but it's worth mentioning in the same vein as this bug.

Implement "tabs" for output graphs

In the legacy cFIREsim, every new simulation creates a new browser tab. This allows for easy comparison between multiple similar simulations. With the new javascript code, I believe that it is inconveinient to open a new tab and pass along the data, which is why I opted for a pop-up window. However, this makes it hard to compare simulations, because you can't easily open multiple simulations at once.

We either need to implement some psuedo-tabs in the output pop-up, or re-implement the legacy version by sending the data to a new tab.

Recreate Investigate Asset Allocations

Legacy cFIREsim had an "Investigate" option that explored the success rates of varying equities/bonds allocations in 5% increments. We must recreate this option in the "Data Options" section.

Implement Monte Carlo simulation

This should be slightly more robust than the legacy cFIREsim. We should be able to allow users to vary the amount of iterations. If we have a more math-oriented programmer out there, we could start adding in other types of distributions, rather than just the normal distribution.

I can provide the legacy code for this, to anyone willing to take up the task. (It isn't currently public).

Shrinking the Data Options - Specific Years causes blank output

I'm not entirely sure that this is just a validation problem. Obviously, if the data start/end dates are within a span of less years than the requested simulation (ie you give a span from 1960-1970 which is only 10 years, but you want a simultion from 2015-2040 which is 25 years) you'll get an error.

I would expect that if you used the default values, and simply changed the Data Options - Specific Years to Start Year: 1940, End Year: 1970, that it would work. However, this gives a blank output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.