Performs statistical tests to verify if a time series follows a martingale property and maintains market consistency. Three different testing methods are available.

esgmartingaletest(
  r,
  X,
  p0,
  alpha = 0.05,
  method = c("onevsone", "trend", "ratio")
)

Arguments

r

Risk-free rate (scalar or time series)

X

Time series of asset prices or values

p0

Initial price(s) for comparison

alpha

Significance level for hypothesis tests (default: 0.05)

method

Testing method:

  • "onevsone": One-to-one comparison test

  • "trend": Trend analysis test

  • "ratio": Ratio-based test

Value

A list containing test results, which may include:

  • t-statistic and p-value for ratio test

  • trend analysis results

  • mean and standard deviation of martingale differences

Details

The function implements three different approaches to test for martingale properties:

  • "onevsone": Compares each observation against its expected value

  • "trend": Analyzes trends in the martingale differences

  • "ratio": Tests the ratio between discounted values and initial prices

The test results help determine if the time series maintains the martingale property and market consistency under the risk-neutral measure.

Examples

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

# Perform martingale test using ratio method
result <- esgmartingaletest(r, X, p0, method = "ratio")
#> Warning: NaNs produced

# Perform trend analysis
trend_result <- esgmartingaletest(r, X, p0, method = "trend")
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo