Page 1

Discrete Time Rescaling Theorem: Determining Goodness

of Fit for Discrete Time Statistical Models of Neural

Spiking

Citation

Haslinger, Robert, Gordon Pipa, and Emery Brown. “Discrete

Time Rescaling Theorem: Determining Goodness of Fit for

Discrete Time Statistical Models of Neural Spiking.” Neural

Computation 22.10 (2010): 2477-2506. © 2010 Massachusetts

Institute of Technology.

As Published

http://dx.doi.org/10.1162/NECO_a_00015

Publisher

MIT Press

Version

Final published version

Accessed

Wed May 18 08:24:13 EDT 2011

Citable Link

http://hdl.handle.net/1721.1/60336

Terms of Use

Article is made available in accordance with the publisher's policy

and may be subject to US copyright law. Please refer to the

publisher's site for terms of use.

Detailed Terms

Page 2

ARTICLE

Communicated by Ron Meir

Discrete Time Rescaling Theorem: Determining Goodness

of Fit for Discrete Time Statistical Models of Neural Spiking

Robert Haslinger

robhh@nmr.mgh.harvard.edu

Martinos Center for Biomedical Imaging, Massachusetts General Hospital,

Charlestown, MA 02129, U.S.A., and Massachusetts Institute of Technology,

Department of Brain and Cognitive Sciences, Cambridge, MA 02139, U.S.A.

Gordon Pipa

mail@g-pipa.com

Massachusetts Institute of Technology, Department of Brain and Cognitive Sciences,

Cambridge, MA 02139, U.S.A.; Max-Planck Institute for Brain Research,

Department of Neurophysiology, 60528 Frankfurt am Main, Germany; and

Frankfurt Institute for Advanced Studies, 60438 Frankfurt am Main, Germany

Emery Brown

enb@neurostat.mit.edu

Massachusetts Institute of Technology, Department of Brain and Cognitive Sciences,

Cambridge, MA 02139, U.S.A., and Massachusetts General Hospital, Department

of Anesthesia and Critical Care, Boston, MA 02114, U.S.A.

One approach for understanding the encoding of information by spike

trains is to fit statistical models and then test their goodness of fit. The

time-rescaling theorem provides a goodness-of-fit test consistent with

the point process nature of spike trains. The interspike intervals (ISIs)

are rescaled (as a function of the model’s spike probability) to be in-

dependent and exponentially distributed if the model is accurate. A

Kolmogorov-Smirnov (KS) test between the rescaled ISIs and the expo-

nential distribution is then used to check goodness of fit. This rescaling

relies on assumptions of continuously defined time and instantaneous

events.However,spikeshavefinitewidth,andstatisticalmodelsofspike

trains almost always discretize time into bins. Here we demonstrate that

finite temporal resolution of discrete time models prevents their rescaled

ISIs from being exponentially distributed. Poor goodness of fit may be

erroneouslyindicatedevenifthemodelisexactlycorrect.Wepresenttwo

adaptations of the time-rescaling theorem to discrete time models. In the

first we propose that instead of assuming the rescaled times to be expo-

nential,thereferencedistributionbeestimatedthroughdirectsimulation

by the fitted model. In the second, we prove a discrete time version of the

time-rescaling theorem that analytically corrects for the effects of finite

Neural Computation 22, 2477–2506 (2010)

c ?2010 Massachusetts Institute of Technology

Page 3

2478R. Haslinger, G. Pipa, and E. Brown

resolution. This allows us to define a rescaled time that is exponentially

distributed, even at arbitrary temporal discretizations. We demonstrate

the efficacy of both techniques by fitting generalized linear models to

both simulated spike trains and spike trains recorded experimentally in

monkeyV1cortex.Bothtechniquesgivenearlyidenticalresults,reducing

the false-positive rate of the KS test and greatly increasing the reliability

of model evaluation based on the time-rescaling theorem.

1 Introduction

One strategy for understanding the encoding and maintenance of informa-

tion by neural activity is to fit statistical models of the temporally varying

and spike history–dependent spike probability (conditional intensity func-

tion) to experimental data. Such models can then be used to deduce the

influence of stimuli and other covariates on the spiking. Numerous model

types and techniques for fitting them exist, but all require a test of model

goodness of fit, which is crucial to determine a model’s accuracy before

making inferences from it. Any measure of goodness of fit to spike train

data must take the binary nature of such data into account (e.g., discretized

in time, a spike train is a series of zeros and ones). This makes standard

goodness-of-fit tests, which often rely on assumptions of asymptotic nor-

mality, problematic. Further, typical distance measures such as the average

sum of squared deviations between recorded data values and estimated

values from the model often cannot be computed for point process data.

One technique, proposed by Brown, Barbieri, Ventura, Kass, and Frank

(2001) for checking the goodness of fit of statistical models of neural spik-

ing, makes use of the time-rescaling theorem. This theorem states that if

the conditional intensity function is known, then the interspike intervals

(ISIs) of any spike train (or indeed any point process) can be rescaled so

that they are Poisson with unit rate, that is, independent and exponentially

distributed. Checking goodness of fit is then easily accomplished by com-

paring the rescaled ISI distribution to the exponential distribution using

a Kolmogorov-Smirnov (KS) test (Press, Teukolsky, Vetterling, & Flannery,

2007; Massey, 1951). The beauty of this approach is not only its theoretical

rigor, but also its simplicity, as the rescaling requires only the calculation

of a single integral. Further, a second transformation takes the exponen-

tially distributed rescaled times to a uniform distribution, and the KS test

can then be performed graphically using a simple plot of the cumulative

density function (CDF) of the rescaled times versus the CDF of the uni-

form distribution to determine if the rescaled times lie within analytically

definedconfidencebounds.Duetoitsmanyappeals,thetimerescalingthe-

orem has been extensively used to test model goodness of fit to spike train

data (Frank, Eden, Solo, Wilson, & Brown, 2002; Truccolo, Eden, Fellows,

Donoghue, & Brown, 2005; Czanner et al., 2008; Song et al., 2006).

Page 4

Discrete Time Rescaling Theorem2479

There are, however, certain neurophysiological situations in which the

standard time-rescaling approach can give misleading results, indicating

poor goodness of fit when model fit may in fact be very good. This is a

consequence of the practical numerical consideration that when a statistical

model is fit to spike data one almost always discretizes time into bins. The

time-rescaling theorem applies exactly to a continuous time point process

(e.g., if we have infinite temporal precision and if the events, that is the

spikes, are instantaneous). In a practical neuroscience setting, however, we

usually do not have infinite temporal precision. First, a spike is an event

that lasts for a finite (∼1 msec) period of time, and any temporal resolution

far below this lacks physical relevance.1Second, from a computational

perspective, the fitting of statistical models requires much less computer

time when the temporal discretization is coarser. Temporal discretization

therefore imposes both physical and practical numerical constraints on the

problem.

Often the probability per bin of a spike is small, and the distinction be-

tween continuous and discrete time of no concern, because the width of a

spike is very short compared to the average interspike interval. Neverthe-

less, there are cases for which firing rates can be very high due to strong

stimuli and ISIs short due to burst-type dynamics, and here the the per bin

spike probability can be large even at 1 msec resolution or less. Such situa-

tions can arise in, for example, primate visual experiments where neurons

can be extremely active (De Valois, Yund, & Hepler, 1982; MacEvoy, Hanks,

& Paradiso, 2007; also see section 3 of this article), exhibiting firing rates of

up to 100 Hz or more. In such situations, it is important to ensure that the

rescaled ISIs are still (approximately) exponentially distributed and if not,

to determine the correct distribution before performing the KS test.

Our aim in this article is to develop simple and easily applied goodness-

of-fit tests for the discrete time case. We first restate the standard, con-

tinuous time form of the time-rescaling theorem for point processes and

then demonstrate the discretization problem using a simple homogeneous

Bernoulli (discretized homogeneous Poisson) process. We show theoreti-

cally that the discrete nature of the Bernoulli process results in first a lower

bound on the smallest possible rescaled ISI, and second, because there can

be only one spike per bin, a spike probability less than that which would

be estimated by a continuous time model. These differences lead to biases

in the KS plot caused by fundamental differences in the shapes of the geo-

metric and exponential distributions, not by poor spike sampling or poor

numerical integration techniques. We demonstrate further that these biases

persist for more complicated simulated neural data with inhomogeneous

1This statement applies if one considers the spike as an event, as we do here. If

one instead is interested in the shape and timing of the spike waveform—for example,

the exact time of the waveform peak—then temporal resolutions of ?1 msec may be

physically relevant.

Page 5

2480R. Haslinger, G. Pipa, and E. Brown

firing rates and burst-type spike history effects. We show that the biases

increase when spike history effects are present.

We then propose two computationally tractable modifications to the

time-rescaling theorem applicable to discrete time data. The first is similar

in spirit to a bootstrap and involves direct simulation of confidence bounds

on the rescaled ISI distribution using the statistical model being tested. In

the second method, by randomly choosing exact spike times within each

binandintroducingacorrectiontothefitteddiscretespikeprobabilities,we

defineananalyticrescaledtimethatisexponentiallydistributedatarbitrary

temporal discretizations. Use of this analytical method gives results nearly

identical to the numerical approach. In this article, we use generalized lin-

ear models (GLMs) with logistic link functions (McCullagh & Nelder, 1989;

Wasserman,2004).However,weemphasizethatbothprocedureswillapply

to any discrete time statistical model of the time-varying spike probability,

not only GLMs. We demonstrate both approaches using simulated data

and also data recorded from real V1 neurons during monkey vision exper-

iments. In all our examples, the KS plot biases are eliminated. Models for

which the original KS plots originally lay outside 95% confidence bounds

are demonstrated to in fact be very well fit to the data, with the modified

KS plots lying well within the bounds. In addition to providing more accu-

rate statistical tests for discrete time spiking models, our approaches allow

the use of larger time bin sizes and therefore can substantially decrease the

computation time required for model fitting.

2 Theory

The time-rescaling theorem states that the ISIs of a continuous time point

process can be transformed, or rescaled, so that the rescaled process is Pois-

son with unit rate (e.g., the rescaled ISIs are independent and exponentially

distributed). This variable transform takes the form

τi=

?ti

ti−1

λ(t | Ht)dt,

(2.1)

where {ti} is the set of spike times and λ(t | Ht) is the conditional inten-

sity function: temporally varying and history-dependent spike probability.

Although we henceforth drop the Htin our notation, such conditioning

on the previous spiking history is always implied. Intuitively, the ISIs are

stretched or shrunk as a function of total spike probability over the ISI

interval so that the rescaled ISIs are centered about a mean of 1. Several

proofs of this theorem exist (Brown et al., 2001). Here we present a simple

proof of the exponential distribution of the rescaled ISIs. A proof of their

independence is in appendix A.

Page 6

Discrete Time Rescaling Theorem2481

The proof proceeds by discretizing time into bins of width ?, writing

down the probability for each discrete ISI, and then taking the continuous

time limit: ? → dt. The discrete time bins are indexed as k, and the bins

within which the spikes occur are denoted as ki. Further, we define pkas the

discrete probability mass of a spike in bin k, and like λ(t), it should be taken

as conditionally dependent on the previous spiking history.

The probability of the ith ISI is the probability that there is a spike in bin

kigiven that the preceding spikes were located in bins k1,k2,...,ki−1:

P(ISIi) = P(ki| k1,k2,...,ki−1) =

?Li−1

l=1

?

(1 − pki−1+l)

?

pki−1+Li,

(2.2)

whereLiisdefinedsuchthatki−1+ Li= ki.Thisissimplytheproductofthe

probabilities that there are no spikes in bins k = {ki−1+ 1,ki−1+ 2,...,ki−

1} multiplied by the probability that there is a spike in bin k = ki. For

simplicity, we now drop the i subscripts.

In preparation for taking the small bin size limit, we note that when ?

becomes small, so does p: p ? 1 for all bins. This implies that 1 − p ≈ e−p,

allowing the above equation to be rewritten as

P(ISI) = P(k + L)≈exp

?

−

L

?

l=1

pk+l

?

pk+L.

(2.3)

Note that the upper limit of the sum has been changed from L − 1 to L with

the justification that we are in a regime where all the p’s are very small. We

define the lower and upper spike times as tk= k? and t = tk+L= (k + L)?,

define λ(tk+l) such that pk+l= λ(tk+l)?,2and also define the ISI probabil-

ity density P(t) such that P(k + L) = P(t)?. After substituting these into

equation 2.3 and converting the sum to an integral, we obtain

P(t)dt = e−?t

tkλ(t?)dt?λ(t)dt.

(2.4)

Consulting equation 2.1, we note that the integral in the exponent is, by

definition, τ. Further, applying the fundamental theorem of calculus to this

2λ(tk+l) = ?λ(t)?k+l, where the average is taken over the time bin k. This definition

holds only when the bin size is very small. We will show that for moderately sized bins,

pk+l?= λ(tk+l)?, and that this leads to biases in the KS plot.

Page 7

2482R. Haslinger, G. Pipa, and E. Brown

integralgivesdτ = λ(t)dt.3Changingvariablesfromttoτ,wefinallyobtain

P(τ)dτ = e−τdτ,

(2.5)

which is now exponentially distributed and completes the proof.

Although the τi can be compared to the exponential distribution, it is

useful to note that a second variable transform will make the rescaled ISIs

uniformly distributed:

zi= 1 − e−τi.

(2.6)

General practice is to sort the rescaled ISIs ziinto ascending order and plot

them along the y-axis versus the uniform grid of values bi=i−0.5

N is the number of ISIs and i = 1,..., N. If the rescaled ISIs ziare indeed

uniformly distributed, then this plot should lie along the 45 degree line.

Essentially the cumulative density function (CDF) of the rescaled ISIs zi

is being plotted against the CDF of the uniform distribution (the bi’s). We

show an example of such a plot in Figure 1. Such a plot can be thought of

as a visualization of a KS test, which compares two CDFs and is usually

referred to as a KS plot. Formally we can state the null hypothesis H0of this

test as follows:

N, where

H0: Given a model of the conditional intensity function that is statistically

adequate, the experimentally recorded ISIs can be rescaled so that they

are distributed in the same manner as a Poisson process (exponentially

distributed) with unit rate.

Underthenullhypothesis,themaximumdistancebetweenthetwoCDFs

will, in 95% of cases, be less than1.36

ISIs(Brownetal.,2001;Johnson&Kotz,1970).Equivalently,theplottedline

of rescaled ISIs will lie within the bounds bk±1.36

the null hypothesis. It should be kept in mind that this is not equivalent to

saying that the line of rescaled ISIs lying within these bounds implies a 95%

chance of the model being correct.

√N, where N is the number of rescaled

√Nin 95% of cases under

2.1 Temporal Discretization Imposes KS Plot Bias. The time-rescaling

theorem applies exactly to a point process with instantaneous events

(spikes) and infinite temporal precision (i.e., continuous time). As a prac-

tical matter, one generally discretizes time when fitting a statistical model.

3Specifically,

dτ

dt

and therefore dτ = λ(t)dt.

=

d

dt

?t

tk

λ(t?)dt?= λ(t),

Page 8

Discrete Time Rescaling Theorem2483

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.80.91

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Discrete Time

Continuous Time

Kolmogorov Smirnov (KS) Plot

empirical CDF(z)

uniform CDF

Figure 1: Two simple KS plots demonstrating that temporal discretization in-

duces biases even if the conditional intensity function used to calculate the

rescaled times is exactly correct. CDF of the rescaled times z is plotted along

the x-axis versus the CDF of the uniform (reference) distribution along the y-

axis. Spikes were generated from an inhomogeneous Poisson process with a

maximum firing rate of 50 Hz. Thick gray dashed line: KS plot of rescaled ISIs

generated by a continuous time model. Thick gray solid line: KS plot of rescaled

ISIs calculated from the same model discretized at 5 msec resolution. The dis-

cretization was deliberately enhanced to emphasize the effect. Thin black 45

degree lines are 95% confidence bounds on the KS plots.

For discrete time, the integral of equation 2.1 is naively replaced by

τi=

ki

?

k=ki−1+1

pk.

(2.7)

If pk? 1 ∀k (i.e., situations where either the bin size is very small ? →

0 or the firing rate is very low), the time-rescaling theorem will apply

approximately even if a discrete time model is used. However, it often

happensthatpkisinfactlarge.Forexample,50Hzspikingsampledat1msec

implies p ≈ 0.05, and under many conditions, the firing rate can be much

Page 9

2484R. Haslinger, G. Pipa, and E. Brown

higher, at least over some subset of the recording (e.g., during bursting). In

such cases, the rescaled times τiwill not be exponentially distributed, and

the KS plot will exhibit significant biases (divergences from the 45% line)

even if the discrete time model for pkis exactly correct. We demonstrate

this in Figure 1 where two KS plots generated using the exact same spikes

and time-varying firing rate are shown, but a temporal discretization was

imposed for one of the plots.

These biases originate in two distinct consequences of discretizing a

continuous process. First, there is a lower bound on the smallest possible

ISI(onebin),whichleadstoalowerboundonthesmallestpossiblerescaled

time z. Second, because only a single spike per bin is allowed, using a

discrete time model to estimate the firing rate of a continuous time process

results in an underestimation of the firing rate. To demonstrate these issues

fully, we now consider the simple case of a homogeneous Bernoulli process

with a constant spike probability pk= p per bin for which the the CDF of

the z’s can be calculated analytically and the KS plot determined exactly.

For a discrete time process, only a discrete set of ISIs is possible—

specifically {n?}, where n is an integer greater than zero and ? is the

bin width. In the case of a homogeneous Bernoulli process, the rescaled ISIs

are τ(n) = pn and

z(n) = 1 − e−pn,

(2.8)

and the discrete probability distribution of interspike interval times (and

rescaled times) is

PB(n) = (1 − p)n−1p.

(2.9)

As in equation 2.2, this is merely the product of the probability of no spike

for n − 1 bins, followed by the probability of a spike in the last (nth) bin.

The B subscript indicates the Bernoulli process. PB(n) is not an exponential

distribution, as would be expected for a homogeneous Poisson process.

It is a geometric distribution, although in the limit of small p it reduces

to an exponential distribution.4The CDF of this ISI distribution is easily

calculated by summing the geometric series and combining terms:

CDFB(n) =

n

?

j=1

PB(j)=

p

1 − p

=1 − (1 − p)n.

n

?

j=1

(1 − p)j

(2.10)

4Setting p = λ? and t = n?, PB(t) = (1 − p)n−1p =

PP(t)dt, when the limit ? → dt is taken.

λ?

1−λ?(1 − λ?)t/?→ λe−λtdt =

Page 10

Discrete Time Rescaling Theorem2485

01

0

1

p=0.2

p=0.1

p=0.04

0 0.20.4 0.60.81

-0.05

0

0.05

0.1

0.15

0.2

p=0.2

p=0.1

p=0.04

AB

CDF(uniform) - CDF(Bernoulli)

Uniform CDF

KS Plot

Differential KS Plot

Empirical CDF (z)

z

Figure 2: Illustration of KS plot bias induced when a homogeneous Poisson

process is discretized to a homogeneous Bernoulli process. (A) KS plot for

various spike per bin probabilities p. Blue: p = 0.2, green: p = 0.1, red: p = 0.04

(40Hzat1msecdiscretization).Therescaledtimesarenotuniformlydistributed

but have positive bias at rescaled ISIs close to 0 and negative bias at rescaled

ISIs close to 1. (B) Differential KS Plot: CDFunif orm− CDF(z)Bernoulli. Biases are

easiertoseeifthedifferencebetweentheexpectedCDF(uniform)andtheactual

CDF of the rescaled times is plotted. The colors indicate the same spike per bin

probabilitiespasinA.Thehorizontaldashedlinesarethe95%confidenceregion

assuming 10 minutes of a 40 Hz Bernoulli process (24,000 spikes).

To get the CDF of the rescaled ISIs z, equation 2.8 is inverted to get n =

−log(1−z(n))

p

and substituted into equation 2.10:

CDFB(z) = 1 − (1 − p)−log(1−z(n))

p

z(n − 1) ≤ z ≤ z(n).

(2.11)

In Figure 2 we use equation 2.11 to generate the KS plot for various

spikes per bin probabilities p. Even at p = 0.04, which would correspond

to 40 Hz firing at 1 msec discretization, the CDF is highly nonuniform

with a steplike structure caused by the discrete values that the rescaled ISIs

can take. Such “steps” will be smoothed out if an inhomogeneous Bernoulli

processisusedinstead.Thereis,however,anothermoreseriousdivergence

from uniformity: a distinct positive bias at low (close to 0) rescaled ISIs and

a distinct negative bias at high (close to 1) rescaled ISIs. This bias will not

disappear if an inhomogeneous Poisson process is used.

The dashed lines, which are barely visible, denote the 95% confidence

regionoftheKSplotassuming10minutesof40Hzspiking,whichtranslates

into 24,000 spikes on average. Since the confidence bounds are so close to

the 45 degree line, and will be for any spike train with a long recording time

and appreciable firing rate, we introduce a new type of plot in Figure 2,

Page 11

2486R. Haslinger, G. Pipa, and E. Brown

which we term a differential KS plot. This is simply a plot of the difference

between the distribution we hypothesize that the CDF of rescaled times

should follow (in this case uniform) and the CDF of the experimentally

recordedrescaledISIs(inthiscasetherescaledISIsoftheBernoulliprocess):

CDFhyp(z) − CDFexp(z).

(2.12)

The differential KS plot displays the same information as the KS plot, but

does so in a different and more visually accessible manner. The confidence

bounds (the horizontal dashed lines in Figure 2) are now simply given by

±1.36

clearlyseethepositivebiasatlowvaluesoftherescaledISIsandthenegative

biasathighvaluesoftherescaledISIs.WeemphasizethatsincetheseKSand

differential KS plots are calculated using the exact homogeneous Bernoulli

distribution, the biases are not finite sampling effects.

The positive bias at low ISIs is easily understood by noting that the

smallest possible rescaled time is not zero but

√N,whereNisagainthenumberofrescaledISIs.Plottedthisway,onecan

z(1) = 1 − e−p= p −p2

2

+ ··· > 0.

(2.13)

What about the negative bias at large (z close to 1) rescaled ISIs? Consider a

homogeneous Poisson process with a firing rate λ. Upon discretizing time

into bins of width ?, one might naively expect the probability of a spike

per bin to be p = λ?. However, it is in fact slightly less than this, as we

now show. Assume a spike at time t = 0. Then for a homogeneous Poisson

process, the probability density for the waiting time twuntil the next spike

is ρ(tw) = λe−λtw. Integrating, the probability that the next spike lies within

any interval t < tw≤ t + ? can be obtained:

?t+?

P(t < tw≤ t + ?) =

t

λe−λt?dt?= e−λt(1 − e−λ?).

(2.14)

Defining the bin index n such that t = (n − 1)? and discretizing, we get

P(nw= n)=e−λ?(n−1)(1 − eλ?)

=[1 − (1 − e−λ?)]n−1(1 − e−λ?)

=(1 − p)n−1p,

(2.15)

wherewehavedefined p = 1 − e−λ?inthelastline.Discretizingtimetrans-

formsthehomogeneousPoissonprocessintoahomogeneousBernoullipro-

cess, but with a per bin probability of a spike p ?= λ?. In fact, by expanding

Page 12

Discrete Time Rescaling Theorem2487

the exponential as a Taylor series, it can be seen that

p = 1 − e−λ?= λ? −(λ?)2

2

+ ··· < λ?.

(2.16)

The continuous Poisson process still has an expected number of spikes per

interval of width ? of??

0 or 1 spikes per bin. Therefore the per bin “spike probability” p calculated

above is not the expected number of spikes of the continuous point process

within an interval ?. It is the expected number of first spikes in an interval

?, which is, of course, less than the total number of expected spikes. Any

chance of there being more than one spike in a time window ? has been

eliminated by discretizing into bins.

The breakdown of the first-order expansion of the exponent is the source

of the negative KS plot bias at high (z close to 1) rescaled ISIs. It is a fun-

damental consequence of discretizing a continuous time point process and

is closely connected to how the conditional intensity function is generally

defined, that is, as the small bin size limit of a counting process (see Snyder,

1975). More specifically the conditional intensity function is the probabil-

ity density of single spike in an infinitesimal interval [t,t + ?). As shown

above, this probability density is actually p/? = (1 − e−λ?)/? < λ, and the

equality holds only in the limit. Thus, p/? is not a good approximation for

λ when the bin size is too large, and this causes the time-rescaling theorem

to break down.

0λdt = λ?, but such an interval could have more

than one spike in it. In contrast, the discrete Bernoulli process can have only

2.2 InhomogeneousBernoulliProcesses. The samepositive (negative)

bias in the KS plot at low (high) rescaled ISIs remains when the spiking

process is not homogeneous Bernoulli. We now we define three inhomoge-

neousspikingmodelsincontinuoustimeandsubsequentlydiscretizethem.

We use these inhomogeneous discrete time models to simulate spikes and

then calculate the rescaled ISIs using the exact discrete time model used to

generate the spikes in the first place. The goal is to show that even if the ex-

act discrete time generative model is known, the continuous time-rescaling

theorem can fail for sufficiently coarse discretizations.

The first model is an inhomogeneous Bernoulli process. One second of

the inhomogeneous firing probability is shown in Figure 3A. The specific

functional form was spline based, with knots spaced every 50 msec and the

splinebasisfunctioncoefficientschosenrandomly.Thismodelfiringproba-

bility was repeated 600 times for 10 minutes of simulated time. The second

and third models were the homogeneous and inhomogeneous Bernoulli

models, respectively, but with the addition of a spike history–dependent

renewal process shown in Figure 3B. We used a multiplicative model for

Page 13

2488R. Haslinger, G. Pipa, and E. Brown

0 200400

msec

6008001000

0

20

40

60

Hz

0102030

0

2

4

msec since prev spike

Inhomog. Bernoulli

With History

0

Empirical CDF (z)

0.51

0

0.5

1

0 0.5

z

1

-0.01

0

0.01

0.02

0.03

0

Empirical CDF (z)

0.51

0

0.5

1

0 0.5

z

1

0

0.02

0.04

0.06

0.08

0

Empirical CDF (z)

0.51

0

0.5

1

0 0.5

z

1

0

0.02

0.04

0.06

A

B

C

D

E

F

G

H

Inhomog.

Bernoulli

Homog. Bernoulli

With History

Rate Function

Spike History Function

Uniform CDF

Uniform CDF

Uniform CDF

CDF Difference

Figure 3: KS and differential KS plots for 10-minute-long 40 Hz mean firing

rate simulated spike trains. Three continuous time models of the conditional in-

tensity function were used for simulation: inhomogeneous Poisson process, ho-

mogeneous Poisson with a renewal spike history process, and inhomogeneous

Poisson with a renewal spike history process. (See the text.) The continuously

defined processes were discretized at various values ? and used to simulate

spikes. (A) 40 Hz mean inhomogeneous Bernoulli firing rate. (B) Spike history

term λhistas a function of time since the most recent spike. (C, D) KS and differ-

ential KS plots for inhomogeneous Bernoulli process. Blue: ? = 1 msec, green:

? = 0.5 msec, red: ? = 0.1 msec. Horizontal dashed lines are 95% confidence

bounds.(E,F)HomogeneousBernoulliprocesswithspikerenewalhistoryterm.

(G, H) Inhomogeneous Bernoulli process with spike renewal history term. Note

that when spike history effects are present, the biases are larger at both short

and long rescaled ISIs.

the history–dependent firing probabilities of the form

λ(t) = λ0(t)λhist(t − tls),

where λ0(t) is the time-dependent firing probability independent of spike

history effects and λhist is the spike history–dependent term, which is a

(2.17)

Page 14

Discrete Time Rescaling Theorem2489

function of the time since the last spike (t?= t − tls). The functional form of

the spike history–dependent term was a renewal process, specifically

λhist(t?) =1 + 3e−(t?−2)/5

1 + e−4(t?−2),

(2.18)

wheret?= t − tlsisinmsec.Thisformwaschosentomimicabriefrefractory

periodandsubsequentrebound.Forcomparisonpurposes,allthreeofthese

models were constructed so that the mean firing rate remained approxi-

mately 40 Hz. Thus, the inhomogeneous Bernoulli firing probability had a

40 Hzmean.In the spike history–dependentcases,the history-independent

firing probabilities λ0(t) were adjusted downward so that when history ef-

fects were included, the mean firing rate remained approximately 40 Hz.

Specifically, the history-independentfiring probability of the homogeneous

Bernoulli process was reduced to 29 Hz, and a similar reduction was made

for the inhomogeneous Bernoulli model.

In Figure 3, we demonstrate the effect on the KS and differential KS

plots when these models are subjected to various temporal discretizations.

Specifically, we discretized the models at 1, 0.5, and 0.1 msec resolution

by averaging λ0(t) over these bin widths: pk,0= ?λ0(t)?k. The spike history–

dependent term is a function of t?= t − tls, which was also partitioned into

bins. Similar averaging was then employed so that pk?,hist= ?λhist(t?)?k?. The

full discrete conditional spike probability is then pk= pk,0pk−kls,hist, where

klsisdefinedasthemostrecentbinpriortobinkthathasaspikeinit.Wethen

simulated 10 minutes worth of spikes for each model and discretization.5

After generating the spikes, we then calculated the rescaled times and CDF

difference plots according to

zi= 1 − e−?ki

k=ki−1pk.

(2.19)

Figures 3C and 3D show the results for the inhomogeneous Bernoulli

model. Comparison with Figure 2 reveals that the main effect of inhomo-

geneity is to smooth out the steps. The positive (negative) biases at low

(high) rescaled times remain, and, as expected, they are smaller for finer

temporal discretizations. Figures 3E to 3H show the results when the spike

history–dependent term is added to both the homogeneous and inhomo-

geneous Bernoulli models. The important point is that the biases are worse

for both models when spike history effects are included, even though the

models are constructed so that the mean firing rate remains 40 Hz. The

5For the spike history–dependent models, the generation of a spike in bin k modifies

the firing probabilities in bins k?> k. Thus, the simulation proceeded bin by bin, and on

generationofaspike,thefiringprobabilitiesinthefollowingbinswereupdatedaccording

to equation 2.18 before generating the next observation (spike or no spike) in bin k + 1.

Page 15

2490R. Haslinger, G. Pipa, and E. Brown

reason is that the history-dependent term is constructed so that the spike

train exhibits burstlike behavior. Specifically, after a short (2 msec) refrac-

tory period there is an increased probability of a spike. This increases the

number of short ISIs. It also increases the smallest possible rescaled ISI z

because the probability of a spike goes up immediately following a prior

spike, and this ends up shifting distributional weight to short ISIs. This is

an important point because it implies that in real experimentally recorded

spike trains, which may exhibit burst-type behavior, the bias in the KS plot

will be worse than would be expected by a simple estimate based on the

mean firing rate, as given in equation 2.13.

2.3 Unbiased Discrete Time Rescaling Test Using Model Simulation.

In a previous section, we showed analytically that when discrete time mod-

els are used, the rescaled ISIs may not be exponentially distributed even

if the model is exactly correct and that this manifests in the KS plot as

systematic biases. Our first proposed solution (we present a second in the

following section) to the bias problem is not to assume that the rescaled ISIs

are exponentially (or uniformly) distributed, but to instead use a procedure

similar to bootstrapping. This proceeds by noting that if a candidate model

accurately describes the recorded spikes, then the rescaled ISI distribution

of the spikes and the rescaled ISI distribution expected by the fitted model

should be statistically indistinguishable. If instead the model form is in-

appropriate to describe the spiking data, then the rescaled ISI distribution

expected by the candidate model will not match that of the experimentally

recorded spikes, because the model does not describe the recorded spikes

accurately. Although the expected distribution of rescaled ISIs is implicitly

defined by the fitted model, in practice an explicit analytical form for this

distribution may be hard to come by. It can, however, be sampled numer-

ically using the fitted model to generate spikes and rescaling the resulting

ISIs as a function of the model used to generate them.6

Specifically, after a candidate model is proposed and fit to the recorded

spike train data (any type of candidate model may be used as long as it

provides an estimate of the conditional intensity function λ), we use the

model to simulate spikes, rescale the resulting simulated ISIs, and then use

a two-sample KS test to determine if the sample of estimated rescaled ISIs

{zest} and the sample of experimentally recorded rescaled ISIs {zexp} are

consistent with being drawn from the same underlying distribution (Press

et al., 2007). Formally, the null hypothesis of the KS test has been changed

6Most generally, the conditional intensity function will have the form λ(tk) = λ(x(tk) |

H(tk)), where x(tk) is the set of time-varying external covariates and H(tk) is the previous

spiking history. As the originally recorded spike train was of length T and the external

covariates were defined over this time interval, it is simplest to simulate multiple spike

trains the length of the original recording time T. For each spike train simulation, x(t)

remains the same, but H(t) will differ depending on the exact spike times.