Class TsUtils

java.lang.Object
edu.cmu.tetrad.search.utils.TsUtils

public class TsUtils extends Object
Contains some utilities for doing autoregression. Should probably be improved by somebody.
Author:
josephramsey, danielmalinsky (some improvements)
  • Constructor Details

    • TsUtils

      public TsUtils()
  • Method Details

    • ar

      public static DataSet ar(DataSet timeSeries, int numLags)
      Returns:
      the VAR residuals of the given time series with the given number of lags. That is, every variable at the model lag is regressed onto every variable at previous lags, up to the given number of lags, and the residuals of these regressions for each variable are returned.
    • ar2

      public static DataSet ar2(DataSet timeSeries, int numLags)
    • structuralVar

      public static TsUtils.VarResult structuralVar(DataSet timeSeries, int numLags)
    • createShiftedData

      public static DataSet createShiftedData(DataSet data, int[] shifts)
    • getSelfLoopCoefs

      public static double[] getSelfLoopCoefs(DataSet timeSeries)
    • sumOfArCoefficients

      public static double sumOfArCoefficients(DataSet timeSeries, int numLags)
    • difference

      public static DataSet difference(DataSet data, int d)
      Calculates the dth difference of the given data. If d = 0, the original data is returned. If d = 1, the data (with one fewer rows) is returned, with each row subtracted from its successor. If d = 1, the same operation is applied to the result of d = 1. And so on.
      Parameters:
      data - the data to be differenced.
      d - the number of differences to take, >= 0.
      Returns:
      the differenced data.
    • createLagData

      public static DataSet createLagData(DataSet data, int numLags)
      Creates new time series dataset from the given one (fixed to deal with mixed datasets)
    • addIndex

      public static DataSet addIndex(DataSet data)
      Creates new time series dataset from the given one with index variable (e.g., time)
    • graphToLagGraph

      public static TimeLagGraph graphToLagGraph(Graph _graph, int numLags)
    • getNameNoLag

      public static String getNameNoLag(Object obj)
    • getPrefix

      public static String getPrefix(String s)
    • getIndex

      public static int getIndex(String s)
    • getLag

      public static int getLag(String s)
    • getKnowledge

      public static Knowledge getKnowledge(Graph graph)
    • allEigenvaluesAreSmallerThanOneInModulus

      public static boolean allEigenvaluesAreSmallerThanOneInModulus(Matrix mat)