# analysis.granger

## Module: `analysis.granger`

Inheritance diagram for `nitime.analysis.granger`:

Analyzers for the calculation of Granger ‘causality’

## `GrangerAnalyzer`

class nitime.analysis.granger.GrangerAnalyzer(input=None, ij=None, order=None, max_order=10, criterion=<function bayesian_information_criterion>, n_freqs=1024)

  Bases: `BaseAnalyzer`

  Analyzer for computing all-to-all Granger ‘causality’

  __init__(input=None, ij=None, order=None, max_order=10, criterion=<function bayesian_information_criterion>, n_freqs=1024)

    Initializer for the GrangerAnalyzer.

    Parameters:

      input: nitime TimeSeries object :

      ij: List of tuples of the form: [(0, 1), (0, 2)], etc. :

      > These are the indices of pairs of time-series for which the analysis will be done. Defaults to all vs. all.

      order: int (optional) :

      > The order of the process. If this is not known, it will be estimated from the data, using the information criterion

      max_order: if the order is estimated, this is the maximal order to :

      > estimate for.

      n_freqs: int (optional) :

      > The size of the sampling grid in the frequency domain. Defaults to 1024

      criterion: :

      > XXX

  autocov()
  causality_xy()
  causality_yx()
  error_cov()
  frequencies()
  model_coef()
  order()
  simultaneous_causality()
  spectral_matrix()

nitime.analysis.granger.fit_model(x1, x2, order=None, max_order=10, criterion=<function bayesian_information_criterion>)

  Fit the auto-regressive model used in calculation of Granger ‘causality’.

  Parameters:

    x1,x2: float arrays (n) :

    > x1,x2 bivariate combination.

    order: int (optional) :

    > If known, the order of the autoregressive process

    max_order: int (optional) :

    > If the order is not known, this will be the maximal order to fit.

    criterion: callable :

    > A function which defines an information criterion, used to determine the

    >   order of the model.