Calculates vector of balances based on initial balance and vector of ratios from one time point to the next (i.e. proportion gains + 1). This is a simple function containing this R code: initial * cumprod(ratios)

1 |

`ratios` |
Numeric vector of ratios between subsequent stock prices (i.e. proportion gains + 1). For example, if a stock gained 3%, lost 1%, then lost 2%, ratios would be c(1.03, 0.99, 0.98). |

`initial` |
Initial balance. |

Numeric vector indicating balance at each time point.

Dane R. Van Domelen

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

1 2 3 4 5 6 7 8 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.