# analysis.event_related

## Module: `analysis.event_related`

Inheritance diagram for `nitime.analysis.event_related`:

## `EventRelatedAnalyzer`

class nitime.analysis.event_related.EventRelatedAnalyzer(time_series, events, len_et, zscore=False, correct_baseline=False, offset=0)

  Bases: `ResetMixin`

  Analyzer object for reverse-correlation/event-related analysis.

  Note: right now, this class assumes the input time series is only two-dimensional. If your input data is something like (nchannels,nsubjects, …) with more dimensions, things are likely to break in hard to understand ways.

  __init__(time_series, events, len_et, zscore=False, correct_baseline=False, offset=0)
    Parameters:

      time_series : a time-series object

      > A time-series with data on which the event-related analysis proceeds

      events_time_series : a TimeSeries object or an Events object

      > The events which occurred in tandem with the time-series in the EventRelatedAnalyzer. This object’s data has to have the same dimensions as the data in the EventRelatedAnalyzer object. In each sample in the time-series, there is an integer, which denotes the kind of event which occurred at that time. In time-bins in which no event occurred, a 0 should be entered. The data in this time series object needs to have the same dimensionality as the data in the data time-series

      len_et : int

      > The expected length of the event-triggered quantity (in the same time-units as the events are represented (presumably number of TRs, for fMRI data). For example, the size of the block dedicated in the fir_matrix to each type of event

      zscore : a flag to return the result in zscore (where relevant)

      correct_baseline : a flag to correct the baseline according to the first

      point in the event-triggered average (where possible) :

      offset : the offset of the beginning of the event-related time-series,

      relative to the event occurrence :

  FIR()

    Calculate the FIR event-related estimated of the HRFs for different kinds of events

    Returns:

      A time-series object, shape[:-2] are dimensions corresponding to the to :

      shape[:-2] of the EventRelatedAnalyzer data, shape[-2] corresponds to :

      the different kinds of events used (ordered according to the sorted :

      order of the unique components in the events time-series). shape[-1] :

      corresponds to time, and has length = len_et :

  FIR_estimate()

    Calculate back the LTI estimate of the time-series, from FIR

  et_data()

    The event-triggered data (all occurrences).

    This gets the time-series corresponding to the individual event occurrences. Returns a list of lists of time-series. The first dimension is the different channels in the original time-series data and the second dimension is each type of event in the event time series

    The time-series itself has the first diemnsion of the data being the specific occurrence, with time 0 locked to the that occurrence of the event and the last dimension is time.e

    This complicated structure is so that it can deal with situations where each channel has different events and different events have different # of occurrences

  eta()

    The event-triggered average activity.

  ets()

    The event-triggered standard error of the mean

  xcorr_eta()

    Compute the normalized cross-correlation estimate of the HRFs for different kinds of events

    Returns:

      A time-series object, shape[:-2] are dimensions corresponding to the to :

      shape[:-2] of the EventRelatedAnalyzer data, shape[-2] corresponds to :

      the different kinds of events used (ordered according to the sorted :

      order of the unique components in the events time-series). shape[-1] :

      corresponds to time, and has length = len_et (xcorr looks both back :

      and forward for half of this length) :