View source: R/discount_factors.R
esgmcprices | R Documentation |
Calculates the discounted asset prices using simulated interest rates and asset values.
esgmcprices(r, X, maturity = NULL)
r |
Interest rate time series or constant value |
X |
Asset price time series or constant value |
maturity |
Optional maturity date for the calculation |
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.
A time series object containing the discounted asset prices, or a single value if a maturity date is specified
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.