I'm building a monte carlo simulator within R that incorporates a few variables:
- Starting value (say, $100k)
- Contributions/withdrawals at various years between n and n+30 (say, +10k per year for 10 years; then -30k for 20 years)
- Random stock return % (mean = 6%; std. dev = 15%)
- Random bond return % (mean = 1.5%; std. dev = 1.5%)
- Stock allocation through time (can be fixed or also fluctuate)
How would I do that? I've been able to get the random variables, but I'm not able to get them to combine on top of each other (i.e.: $100k * (1+ stock return year n) - withdrawals = ending value n; ending value n*(1 + stock return year n+1) - withdrawals n+1 = ending value n+1; ending value N+2 * (1+ stock return year n+3.... etc.)
Does anyone know of a way to do this?
I'd like to create a way to simulate the ending values for each simulation x 1,000 simulations for a financial planning Monte Carlo simulator.