Package edu.cmu.tetrad.search.utils
Class TsUtils
java.lang.Object
edu.cmu.tetrad.search.utils.TsUtils
Contains some utilities for doing autoregression. Should probably be improved by somebody.
- Version:
- $Id: $Id
- Author:
- josephramsey, danielmalinsky (some improvements)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGives a result consisting of the residuals and collapsed var graphs. -
Method Summary
Modifier and TypeMethodDescriptionstatic DataSetCreates new time series dataset from the given one with index variable (e.g., time)static booleanallEigenvaluesAreSmallerThanOneInModulus.static DataSetar.static DataSetar2.static DataSetcreateLagData(DataSet data, int numLags) Creates new time series dataset from the given one (fixed to deal with mixed datasets)static DataSetcreateShiftedData(DataSet data, int[] shifts) createShiftedData.static DataSetdifference(DataSet data, int d) Calculates the dth difference of the given data.static intgetIndex.static KnowledgegetKnowledge(Graph graph) getKnowledge.static intgetLag.static StringgetNameNoLag(Object obj) getNameNoLag.static StringgetPrefix.static double[]getSelfLoopCoefs(DataSet timeSeries) getSelfLoopCoefs.static TimeLagGraphgraphToLagGraph(Graph _graph, int numLags) graphToLagGraph.static TsUtils.VarResultstructuralVar(DataSet timeSeries, int numLags) structuralVar.static doublesumOfArCoefficients(DataSet timeSeries, int numLags) sumOfArCoefficients.
-
Method Details
-
ar
ar.
- Parameters:
timeSeries- aDataSetobjectnumLags- a int- 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
ar2.
-
structuralVar
public static TsUtils.VarResult structuralVar(DataSet timeSeries, int numLags) throws InterruptedException structuralVar.
- Parameters:
timeSeries- aDataSetobjectnumLags- a int- Returns:
- a
TsUtils.VarResultobject - Throws:
InterruptedException- if any
-
createShiftedData
createShiftedData.
-
getSelfLoopCoefs
getSelfLoopCoefs.
- Parameters:
timeSeries- aDataSetobject- Returns:
- an array of objects
-
sumOfArCoefficients
sumOfArCoefficients.
- Parameters:
timeSeries- aDataSetobjectnumLags- a int- Returns:
- a double
-
difference
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
Creates new time series dataset from the given one (fixed to deal with mixed datasets) -
addIndex
Creates new time series dataset from the given one with index variable (e.g., time) -
graphToLagGraph
graphToLagGraph.
- Parameters:
_graph- aGraphobjectnumLags- a int- Returns:
- a
TimeLagGraphobject
-
getNameNoLag
getNameNoLag.
-
getPrefix
getPrefix.
-
getIndex
getIndex.
- Parameters:
s- aStringobject- Returns:
- a int
-
getLag
getLag.
- Parameters:
s- aStringobject- Returns:
- a int
-
getKnowledge
getKnowledge.
-
allEigenvaluesAreSmallerThanOneInModulus
allEigenvaluesAreSmallerThanOneInModulus.
- Parameters:
mat- aMatrixobject- Returns:
- a boolean
-