Description Usage Arguments Details Value Author(s) Examples

View source: R/sp500SlidingWindow.R

Uses the S&P500 daily data on a series of windows and generates graphs & statistics on the performance.

1 2 | ```
sp500SlidingWindow(investment_vector, withdrawal_vector, window_width = 30,
annual_fee = 0.0125, output_path = "~/")
``` |

`investment_vector` |
a vector of annual investments, (positive values represent investment into the account), length must be window_width |

`withdrawal_vector` |
a vector of annual withdrawals, (positive values represent withdrawal from the account), length must be window_width |

`window_width` |
the number of years in each window |

`annual_fee` |
the total annual percent removed by the investment managers |

`output_path` |
file path to a folder in which graphs & statistics will be saved |

The daily market data for the S&P 500 from 1950 to the present is broken into a series of periods or windows of equal length (except for the last period). The investment and expense data provided is analyzed to see how it would fare in each widow. Graphs and statistics are produced.

data.frame with summary statistics for each window plus the side-effects of graphs written to the output_path given

George Fisher

1 2 3 4 5 6 7 8 9 | ```
## Not run:
investment_vector <- seq(1,30)*10
withdrawal_vector <- c(investment_vector[1:10] * 0.15,
investment_vector[11:20] * 0.35,
investment_vector[21:30] * runif(10, min=0.01, max=0.90))
window_df <- sp500SlidingWindow(investment_vector,
withdrawal_vector, output_path='~/Downloads/')
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.