| nlin_causality.test | R Documentation |
A non linear Granger causality test
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()
)
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 default learning rate is set to 0.1; when utilizing the Adam optimizer, this value serves as the initial learning rate. |
algo |
String argument, Optimizer: Choose between sgd (Stochastic Gradient Descent) and adam. The default is sgd. While sgd uses a fixed learning rate, adam provides adaptive learning rates by tracking the first and second moments of the gradients. |
batch_size |
An integer specifying the number of samples processed before the model's internal parameters are updated during backpropagation. |
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. |
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.
gci: the Granger causality index.
Ftest: the statistic of the test.
pvalue: the p-value of the test.
summary (): shows the test results.
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 ()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.