Histogram routines to help compute the cross-correlation between a pair of spike trains.

Description

For a pair of spike trains, TA (train a) and TB, these related routines return the count of the number of spikes in B that occur within some time window [-tmax,tmax] of a spike in A. For histbi.ab, we return a histogram of dt values from [-tmax,tmax]. For hist.ab, we ignore the sign of each dt and just return a histogram in the range [0,tmax]. Finally, for count.nab, we just return the number of dt values found in the range [-tmax,tmax], rather than binning dt into a histogram.

Usage

1
2
3
hist.ab(ta, tb, tmax, nbins)
histbi.ab(ta, tb, tmax, nbins)
count.nab(ta, tb, tmax)

Arguments

ta

Vector of spike times, sorted such that lowest is first.

tb

Vector of spike times, sorted such that lowest is first.

tmax

maximum time (in seconds) to bin

nbins

Number of bins in the histogram. For histbi.ab, each bin is of width (2*tmax)/nbins. For hist.ab, each bin is (tmax)/nbins wide.

Value

hist.ab returns a histogram of counts ignoring sign. histbi.ab returns a histogram of counts respecting sign. count.nab returns the number of dt values.

METHOD

For the histogram routines, each bin is of the form [low, high), with the exception of the last bin (for +tmax), which is of the form [tmax-binwid, tmax]. By assuming the spikes are ordered lowest first, the number of spike comparisons is greatly reduced, rather than comparing each spike with A with each spike in B.

References

No references here.

See Also

Nothing else yet...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
stopifnot(isTRUE(all.equal.numeric(
  histbi.ab(c(0), c(-2, -2, 0, 0, 1, 1,1, 1.8,2), tmax=2, nbins=4),
  c(2,0,2,5),
  check.attributes=FALSE)))
stopifnot(identical(TRUE, all.equal.numeric(
  hist.ab(c(0), c(-2, -2, 0, 0, 1, 1,1, 1.8,  2), tmax=2, nbins=4),
  c(2,0,3,4),
  check.attributes=FALSE)))
 
test.hist.ab()




## Not run: 
test.histograms.versus.r()
test.count.hist.nab()
test.count.hist.nab(s)
test.count.hist2.nab(s)

## End(Not run)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.