Last data update: 2014.03.03

R: Martingale and market consistency tests
esgmartingaletestR Documentation

Martingale and market consistency tests

Description

This function performs martingale and market consistency (t-)tests.

Usage

  esgmartingaletest(r, X, p0, alpha = 0.05)

Arguments

r

a numeric or a time series object, the risk-free rate(s).

X

a time series object, containing payoffs or projected asset values.

p0

a numeric or a vector or a univariate time series containing initial price(s) of an asset.

alpha

1 - confidence level for the test. Default value is 0.05.

Value

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

Author(s)

Thierry Moudiki

See Also

esgplotbands

Examples

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)

mc.test <- esgmartingaletest(r = r0, X = sim.GBM, p0 = S0, alpha = 0.05)
esgplotbands(mc.test)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ESGtoolkit)
Loading required package: CDVine
The CDVine package is no longer developed actively.
Please consider using the more general VineCopula package
(see https://CRAN.R-project.org/package=VineCopula),
which extends and improves the functionality of CDVine.

Loading required package: ggplot2
Loading required package: gridExtra
Loading required package: reshape2
Loading required package: ycinterextra
Loading required package: compiler

Attaching package: 'ycinterextra'

The following objects are masked from 'package:stats':

    deviance, fitted, residuals

The following object is masked from 'package:base':

    as.list

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ESGtoolkit/esgmartingaletest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: esgmartingaletest
> ### Title: Martingale and market consistency tests
> ### Aliases: esgmartingaletest
> 
> ### ** Examples
> 
> 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)
> 
> 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.16260712 0.8711592
0 Q3  0.93680787 0.3511371
0 Q4  0.00693801 0.9944783
1 Q1 -0.03363110 0.9732390
1 Q2  0.36911463 0.7128306
1 Q3  0.39753877 0.6918261
1 Q4  0.54344405 0.5880457
2 Q1  0.65522732 0.5138411
2 Q2  0.43944877 0.6612941
2 Q3 -0.04001888 0.9681587
2 Q4  0.23087871 0.8178855
3 Q1  0.22593981 0.8217140

95 percent confidence intervals for the mean : 
     c.i lower bound c.i upper bound
0 Q1       0.0000000        0.000000
0 Q2      -0.8545272        1.007087
0 Q3      -0.7160522        1.996934
0 Q4      -1.6409989        1.652515
1 Q1      -2.1252718        2.054429
1 Q2      -1.9295486        2.811505
1 Q3      -2.1256054        3.190737
1 Q4      -2.0745964        3.639627
2 Q1      -2.0959981        4.162764
2 Q2      -2.7355864        4.292001
2 Q3      -3.7768998        3.627562
2 Q4      -3.3390474        4.218416
3 Q1      -3.5825466        4.503266
> esgplotbands(mc.test)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>