esgmccv: Convergence of Monte Carlo prices

View source: R/tests.R

esgmccvR Documentation

Convergence of Monte Carlo prices

Description

Analyzes the convergence of Monte Carlo prices by computing average prices and confidence intervals as the number of simulations increases.

Usage

esgmccv(r, X, maturity, plot = TRUE, ...)

Arguments

r

Interest rate time series or constant

X

Price time series

maturity

Maturity time point

plot

Logical indicating whether to plot the convergence (default: TRUE)

...

Additional arguments passed to plotting functions

Details

The function computes the average price and confidence intervals for increasing numbers of simulations to analyze the convergence of Monte Carlo estimates. It discounts the price series using the provided interest rate and evaluates at the specified maturity.

If plot=TRUE, it creates a plot showing:

  • Confidence intervals as shaded area

  • Average price as a blue line

  • X-axis showing number of simulations

  • Y-axis showing Monte Carlo estimated prices

Value

A list containing:

  • avg.price: Vector of average prices for different numbers of simulations

  • conf.int: Matrix of confidence intervals (lower and upper bounds)

Examples

# Generate sample data
r <- 0.05
X <- ts(matrix(rnorm(1000), 100, 10), start = 0, deltat = 0.1)

# Analyze convergence
convergence <- esgmccv(r, X, maturity = 1)


Techtonique/ESGtoolkit documentation built on June 11, 2025, 6:24 p.m.