symmet.test.lsd: Unimodality and symmetry tests

View source: R/tests.R

symmet.test.lsdR Documentation

Unimodality and symmetry tests

Description

Perform a set of unimodality and symmetry tests useful for simulation model data from a Monte Carlo experiment distributions. The included tests are: Hartigans dip test for unimodality (Hdip), and the Cabilio and Masaro (CM), the Mira (M), and the Miao, Gel and Gastwirth tests for symmetry.

Usage

symmet.test.lsd( data, vars = dimnames( data )[[ 2 ]], start.period = 0,
                 signif = 0.05, digits = 2, sym.boot = FALSE )

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.

sym.boot

logical: set to TRUE to use bootstrap to obtain critical values. The default (FALSE) is to use asymptotic distribution of the statistics.

Details

This function is a wrapper to the functions dip.test in diptest package, and symmetry.test in lawstat 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 Hdip test is an unimodal distribution for the Monte Carlo distribution. Null hypothesis (H0) for CM, M and MGG tests is a symmetric distribution for the Monte Carlo distribution.

Author(s)

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

See Also

ergod.test.lsd(),

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

dip.test(), symmetry.test()

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 symmet.test.lsd to apply the tests on the relevant variables,
#    replacing "var1", "var2" etc. with your data

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

# apply tests
tests <- symmet.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
                          sym.boot = FALSE )    # use bootstrap for precision
print( tests )

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