gains_prices: Convert Gains to Prices

Description Usage Arguments Value Examples

Description

Calculates prices based on initial balance and vector of gains.

Usage

1
gains_prices(gains, initial = 10000)

Arguments

gains

Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one).

initial

Numeric value.

Value

Numeric value if gains is a vector, numeric matrix if gains is a matrix.

Examples

1
2
3
4
5
6
7
# Simulate daily gains over a 5-year period
set.seed(123)
gains <- rnorm(n = 252 * 5, mean = 0.001, sd = 0.02)

# Plot balance over time if initial balance is $10,000
prices <- gains_prices(gains)
plot(prices)

stocks documentation built on May 2, 2019, 9:43 a.m.

Related to gains_prices in stocks...