Calculates the discounted asset prices using simulated interest rates and asset values.
esgmcprices(r, X, maturity = NULL)
A time series object containing the discounted asset prices, or a single value if a maturity date is specified
The function takes interest rates and asset prices as inputs and calculates the discounted asset prices. It handles both time series and constant values for both inputs.
If a maturity date is specified, the function returns the discounted price at that maturity. Otherwise, it returns the time series of discounted prices averaged across all scenarios.
# Using constant values
r <- 0.05
X <- 100
price <- esgmcprices(r, X)
# Using time series
r_ts <- ts(matrix(rnorm(100), 10, 10), start = 0, deltat = 0.1)
X_ts <- ts(matrix(rnorm(100), 10, 10), start = 0, deltat = 0.1)
prices_ts <- esgmcprices(r_ts, X_ts)
# With maturity
price_at_maturity <- esgmcprices(r_ts, X_ts, maturity = 1)
#> Warning: 'end' value not changed
#> Error in window.default(x, ...): 'start' cannot be after 'end'