ergod.test.lsd: Stationarity and ergodicity tests

View source: R/tests.R

ergod.test.lsdR Documentation

Stationarity and ergodicity tests

Description

Perform a set of stationarity and ergodicity tests useful for simulation model data from a Monte Carlo experiment time series. The included tests are: Augmented Dickey-Fuller test (ADF), Phillips-Perron test (PP), Kwiatkowski-Phillips-Schmidt-Shin test (KPSS), Brock-Dechert-Scheinkman test (BDS), Kolmogorov-Smirnov k-sample test (KS), Anderson-Darling k-sample test (AD) and Wald-Wolfowitz k-sample test (WW).

Usage

ergod.test.lsd( data, vars = dimnames( data )[[ 2 ]],
                start.period = 0, signif = 0.05, digits = 2,
                ad.method = c( "asymptotic", "simulated", "exact" ) )

Arguments

data

a three-dimensional array, as the ones produced by read.3d.lsd, organized as (time steps x variables x Monte Carlo instances).

vars

a vector of the variable names (as strings) contained in data for which the tests will be performed. The default is to test all variables.

start.period

integer: the first time step in data to be considered for the tests. The default value is 0 (all time steps considered).

signif

numeric in [0, 1]: statistical significance to evaluate the tests rejection of the null-hypothesis. The default value is 0.05 (5%).

digits

integer: the number of significant digits to show in results. The default is 2.

ad.method

a string in c("asymptotic", "simulated", "exact") defining the methods to be used by ad.test. The default is "asymptotic".

Details

This function is a wrapper to the functions adf.test, kpss.test and bds.test in tseries package, PP.test and ks.test in stats-package and ad.test in kSamples-package.

Value

The function returns a data frame presenting both the average test statistics and the frequency of test null-hypothesis rejections for all the variables selected in vars. Null hypothesis (H0) for ADF and PP tests is non-stationarity of the time series. Null hypothesis (H0) for KPSS test is stationarity of the time series. Null hypothesis (H0) for BDS test the time series is i.i.d.. Null hypothesis (H0) for KS, AD and WW tests is ergodicity of the time series.

Author(s)

Marcelo C. Pereira [aut, cre] (<https://orcid.org/0000-0002-8069-2734>)

See Also

symmet.test.lsd(),

list.files.lsd(), read.3d.lsd() in LSDinterface-package,

adf.test(), bds.test(), kpss.test(),

PP.test(), ks.test() in stats-package(),

ad.test() in kSamples-package

Examples

# get the list of file names of example LSD results
library( LSDinterface )
files <- list.files.lsd( system.file( "extdata", package = "LSDsensitivity" ),
                         "Sim1.lsd", recursive = TRUE )

# Steps to use this function:
# 1. load data from a LSD simulation saved results using a read.xxx.lsd
#    function from LSDinterface package (read.3d.lsd, for instance)
# 2. use ergod.test.lsd to apply the tests on the relevant variables,
#    replacing "var2", "var3" etc. with your data

# read data from Monte Carlo runs
dataSet <- read.3d.lsd( files )

tests <- ergod.test.lsd( dataSet,              # the data set to use
                         c( "var2", "var3" ),  # the variables to test
                         signif = 0.01,        # use 1% significance
                         digits = 4 )          # show results using 4 digits

print( tests )

LSDsensitivity documentation built on July 4, 2022, 1:06 a.m.