Class GrangerTest


  • public class GrangerTest
    extends java.lang.Object
    Implementation of Granger causality test in pure Java. It is based on linear regression implementation in Apache Commons Math.
    Author:
    Sergey Edunov Date: 06.01.11, B.F.A. Hompes (modified code to work with Apache commons-math v3+ (tested with v3.6.1) rather than v2.2)
    • Constructor Summary

      Constructors 
      Constructor Description
      GrangerTest()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static GrangerTestResult granger​(double[] y, double[] x, int L)
      Returns p-value for Granger causality test.
      static double sqrSum​(double[] a)  
      static double[] strip​(int l, double[] a)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrangerTest

        public GrangerTest()
    • Method Detail

      • granger

        public static GrangerTestResult granger​(double[] y,
                                                double[] x,
                                                int L)
        Returns p-value for Granger causality test.
        Parameters:
        y - - predictable variable
        x - - predictor
        L - - lag, should be 1 or greater.
        Returns:
        p-value of Granger causality
      • sqrSum

        public static double sqrSum​(double[] a)
      • strip

        public static double[] strip​(int l,
                                     double[] a)