This function performs martingale and market consistency (t-)tests.
esgmartingaletest(r, X, p0, alpha = 0.05)
a numeric
or a time series object, the risk-free rate(s).
a time series object, containing payoffs or projected asset values.
a numeric
or a vector or a univariate time series containing
initial price(s) of an asset.
1 - confidence level for the test. Default value is 0.05.
The function result can be just displayed. Otherwise, you can get a list by an assignation, containing (for each maturity) :
the Student t values
the p-values
the estimated mean of the martingale difference
Monte Carlo prices
r0 <- 0.03
S0 <- 100
set.seed(10)
eps0 <- simshocks(n = 100, horizon = 3, frequency = "quart")
sim.GBM <- simdiff(n = 100, horizon = 3, frequency = "quart",
model = "GBM",
x0 = S0, theta1 = r0, theta2 = 0.1,
eps = eps0, seed=10)
mc.test <- esgmartingaletest(r = r0, X = sim.GBM, p0 = S0,
alpha = 0.05)
#>
#> martingale '1=1' one Sample t-test
#>
#> alternative hypothesis: true mean of the martingale difference is not equal to 0
#>
#> df = 99
#> t p-value
#> 0 Q2 0.4660930172 0.6421728
#> 0 Q3 0.2032892700 0.8393262
#> 0 Q4 0.8269577275 0.4102498
#> 1 Q1 -0.0005135388 0.9995913
#> 1 Q2 -0.1158973532 0.9079687
#> 1 Q3 -0.3109590592 0.7564855
#> 1 Q4 -0.0098762148 0.9921399
#> 2 Q1 -0.1962804556 0.8447930
#> 2 Q2 0.3589332611 0.7204094
#> 2 Q3 0.3890186048 0.6980978
#> 2 Q4 0.6976756268 0.4870154
#> 3 Q1 0.5972315837 0.5517163
#>
#> 95 percent confidence intervals for the mean :
#> c.i lower bound c.i upper bound
#> 0 Q1 0.0000000 0.000000
#> 0 Q2 -0.6732971 1.086727
#> 0 Q3 -1.2525949 1.538557
#> 0 Q4 -1.0051423 2.441657
#> 1 Q1 -1.8960646 1.895083
#> 1 Q2 -2.1413659 1.905018
#> 1 Q3 -2.4987901 1.821699
#> 1 Q4 -2.3626362 2.339233
#> 2 Q1 -2.6732825 2.192004
#> 2 Q2 -2.2311891 3.216676
#> 2 Q3 -2.0954599 3.117493
#> 2 Q4 -1.8116547 3.776531
#> 3 Q1 -2.0731973 3.858622
esgplotbands(mc.test)