Description Usage Arguments Value Author(s) References See Also Examples
Calculated as: initial * prod(ratios)
.
1 | final.balance(ratios, initial = 10000)
|
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 |
initial |
Initial balance. |
Numeric vector indicating final balance.
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 | # Randomly generate daily stock gains over a 5-year period
set.seed(123)
stockgains <- rnorm(252 * 5, 1.0003, 0.02)
# Calculate final balance if initial balance was $10,000
final.balance(stockgains)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.