R bloggers

Monte Carlo Part Two

FavoriteLoadingAdd to favorites

In a previous post, we reviewed how to set up and run a Monte Carlo (MC) simulation of future portfolio returns and growth of a dollar. Today, we will run that simulation many, many, times and then visualize the results. Our ultimate goal is to build a Shiny app that allows an end user to build a custom portfolio, simulate returns, and visualize the results. If you just can’t wait, a link to the final Shiny app is available here. This post builds off the work we did previously. I won’t go through the logic again, but the code for building a portfolio, calculating returns, mean and standard deviation of returns, and using them for a simulation is here: library(tidyquant) library(tidyverse) library(timetk) library(broom) library(highcharter) symbols <- c(“SPY”,”EFA”, “IJS”, “EEM”,”AGG”) prices <- getSymbols(symbols, src = ‘yahoo’, from = “2012-12-31”, to =…
Original Post: Monte Carlo Part Two