xcorrThe 'xcorr' analysis routine computes cross-correlograms (CCGs), auto-correlograms (ACGs), and all-way shift-predictors. It operates on spike data and continuous (float) data.
A peak at negative times means that chan1 fires before chan2. Thus, the time axis shows what chan1 does relative to a spike on chan2. (Note, the nData Viewer has the opposite convention, which is that the first channel (Channel 0) is the reference channel.)
- plot - make a CCG (or ACG) plot. Use the 'xcorr_flag', 'shift_flag', and 'diff_flag' options to chose which plots are written. 'diff' indicates the CCG minus the shift predictor.
- avg - plot average of diff, shift, or xcorr across trials. For diff, the average is taken across differences (xcorr-shift) for each group.
- avg_stat - write stats for xcorr peak.
- infile - name of input file
- n - number of plots averaged together.
- imax - time lag of peak
- max - value at peak
- fleft - interpolated left-half rise (first to left of peak)
- fright - interpolated right-half rise (first to right of peak)
- fwidth - width at half-height (fright - fleft)
- special_01 -
- special_02 -
- special_03 -
- ac_stat -
- noise_stat -
- rpeak_time -
- rpeak_time_excite -
- xnorm - (frac1)
- raw - coincidences/sec. Or, no normalization for continuous data.
- gmsr - divide by geometric mean spike rate.
- trig1 - spike rate of chan2 given spike on chan1 (thus, the CCG baseline should be the mean firing rate of chan2)
- trig2 - spike rate of chan1 given spike on chan2 (thus, the CCG baseline should be the mean firing rate of chan1)
- frac - ratio of coincidences to expected (for Poisson) coincidences, normalized by individual trial.
- frac1 - like frac, but normalized by mean spike count.
- zscore - for continuous data
- zeromean - for continuous data
- shift_type - 'allway', 'periodic', ... (works with 'plot' option)
- allway - (default) use all possible unmatched trial pairs.
- periodic - shift spikes in trial to left and right, recompute CCG, for periodic (e.g. sinusoidal) stimuli (must set shift_period, see below).
- simple - this option currently applies only to continuous (float) data. It computes a shift predictor by simply shifting the second channel data by one index (allowing wrap-around) and computing the cross-correlation.
- shift_period - 'pep_periodic' or [int_shift_value]
- shift_sigma - SD for Gaussian smoothing of shift-predictor.
- sigma - SD for Gaussian smoothing of xcorr.
- lag - Maximum lag time for plot (sampling units).
- centerflag - replace central value in CCG with average of two neighboring values.
- scenterflag - replace central value in shift-predictory with average of two neighboring values.
- weight_flag - if 1, use weighted average where weight is n times pow(GMSR,weight_power).
- weight_power - The exponent used for computing weights, pow(GMSR,weight_power), by default is 0.0.
- mintrials - minimum number of trials for valid condition.
- mintotspikes - miniumum total number spikes (ignored by some analyses.
- chan1 - first channel name.
- chan2 - second channel name, set equal to chan1 for ACG.
- xcorr_flag - plot the CCG without subtracting the shift predictor.
- shift_flag - plot the shift predictor.
- diff_flag - plot the CCG after subtracting the shift predictor.
- tau0 - Used with 'ac_stat', starting lag for SD calculation.
- taun - Number of consecutive lags for SD calculation (for 'ac_stat')
- exciteflag -
- suppress_win0 - Suppress spikes on chan2 relative to those on chan1 beginning at this time. This will induce negative correlation overall.
- suppress_winn - Suppress spikes on chan2 for this epoch following suppress_win0.
Efficacy and Contribution
- stat_flag_ec - (0) 1-compute efficacy and contribution statistics. The "xnorm" must be "raw". You must set a window for integrating the CCG peak using "win0" and "winn". The following will be written to a file named after the 'outfile' but with an additional '.stat' extension:
- cwd - current working directory
- infile - input file name
- outfile - output file name
- sr1 - firing rate of first channel (spikes/sec)
- sr2 - firing rate of second channel (spikes/sec)
- xarea - integral of raw (CCG - Shift) curve within window (excess coincidence rate)
- strength = 100 * xarea/[(sr1+sr2)/2] (Dan et al 1998)
- toyama = 100 * (xarea/sr1 + xarea/sr2)/2 (Toyama et al 1981)
- simple efficacy = 100 * xarea/sr1
- simple contribution = 100 * xarea/sr2
- x = xarea/sampling + sp1*sp2 (see next)
- sp1 = sr1/sampling
- sp2 = sr2/sampling
- efficacy = (x/sp1 - sp2) / (1 - sp1 - sp2 + x)
- contribution = efficacy * sp1 / sp2
- win0 - (0) start time lag of integration window (sampling units).
- winn - (10) duration of integration window (sampling units).
Example:# # Compute cross-correlation and shift-predictor, avarage over all trials. # xcorr all plot chan1 unit0 # 'unit0' is name of first channel of data chan2 unit1 # 'unit1' is name of first channel of data sampling 1000.0 # time units are milliseconds start 200 # start of analysis window period 1800 # length of analysis window lag 200 # plot CCG from plus/minus this time lag sigma 2.0 # SD of Gaussian for smoothing the CCG (not shift predictor) xcorr_flag 1 # Write the raw CCG to the output file shift_flag 1 # Write the shift predictor to the output file diff_flag 1 # Write the difference, CCC - shift, to output file xnorm gmsr # Use the 'geometric mean spike rate' normalization
Example:# # Cross-correlation and shift-predictor for continous data # xcorr group 1 direction plot chan1 v1_opp1 # name of first channel of data chan2 mt # name of second channel of data sampling 1000.0 # time units are milliseconds start 50 # start of analysis window period 950 # length of analysis window lag 200 # plot CCG from plus/minus this time lag sigma 2.0 # SD of Gaussian for smoothing the CCG (not shift predictor) shift_sigma 0.0 # SD of Gaussian for smoothing the shift predictor shift_type simple # 'simple' is the only choice for float data. xcorr_flag 1 # Write the raw CCG to the output file shift_flag 1 # Write the shift predictor to the output file diff_flag 1 # Write the difference, CCC - shift, to output file xnorm zscore # 'zscore', 'zeromean' or 'raw'
Example:# # Cross-correlation for coherence series from Newsome Data. # xcorr group 1 coherence special_01 start 300 period 1700 lag 200 xnorm gmsr centerflag 1 mintrials 4 weight_flag 1 weight_power 0.0 condition point_count_min unit0 300 1700 4 point_count_min unit1 300 1700 4