nlin_causality.test: A non linear Granger causality test

Description Usage Arguments Details Value Examples

Description

A non linear Granger causality test

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
nlin_causality.test(
  ts1,
  ts2,
  lag,
  LayersUniv,
  LayersBiv,
  iters = 50,
  learningRate = 0.01,
  algo = "sgd",
  batch_size = 10,
  bias = TRUE,
  seed = 0,
  activationsUniv = vector(),
  activationsBiv = vector()
)

Arguments

ts1

Numerical series.

ts2

Numerical series.

lag

The lag parameter

LayersUniv

Integer vector that contains the size of hidden layers of the univariate model. The length of this vector is the number of hidden layers, and the i-th element is the number of neurons in the i-th hidden layer.

LayersBiv

Integer vector that contains the size of hidden layers of the bivariate model. The length of this vector is the number of hidden layers, and the i-th element is the number of neurons in the i-th hidden layer.

iters

The number of iterations.

learningRate

The learning rate to use, O.1 by default, and if Adam algorithm is used, then it is the initial learning rate.

algo

String argument, for the optimisation algorithm to use, in choice ["sgd", "adam"]. By default "sgd" (stochastic gradient descent) is used. The algorithm 'adam' is to adapt the learning rate while using "sgd".

batch_size

Integer argument for the batch size used in the back-propagation algorithm.

bias

Logical argument for the option of using the bias in the networks.

seed

Integer value for the random seed used in the random generation of the weights of the network (a value = 0 will use the clock as random generator seed).

activationsUniv

String vector for the activations functions to use (in choice ["sigmoid", "relu", "tanh"]) for the univariate model. The length of this vector is the number of hidden layers plus one (the output layer). By default, the relu activation function is used in hidden layers, and the sigmoid in the last layer.

activationsBiv

String vector for the activations functions to use (in choice ["sigmoid", "relu", "tanh"]) for the bivariate model. The length of this vector is the number of hidden layers plus one (the output layer). By default, the relu activation function is used in hidden layers, and the sigmoid in the last layer.

Details

A non-linear test of causality using artificial neural networks. Two MLP artificial neural networks are evaluated to perform the test, one using just the target time series (ts1), and the second using both time series. The null hypothesis of this test is that the second time series does not cause the first one.

Value

gci: the Granger causality index.

Ftest: the statistic of the test.

pvalue: the p-value of the test.

summary (): shows the test results.

Examples

1
2
3
4
5
library (timeSeries) # to extract time series
library (NlinTS)
data = LPP2005REC
model = nlin_causality.test (data[,1], data[,2], 2, c(2), c(4), 50, 0.01, "sgd", 30, TRUE, 5)
model$summary ()

Example output

Loading required package: Rcpp
Loading required package: timeDate
--------------------
    Test summary
--------------------
The lag parameter: p = 2
The Granger causality Index: GCI = 0
The value of the F-test: -0.0141991
The p_value of the F-test: 1
The critical value at 5% of risk: 1.746

NlinTS documentation built on Feb. 2, 2021, 9:07 a.m.