{"title": "A recipe for optimizing a time-histogram", "book": "Advances in Neural Information Processing Systems", "page_first": 1289, "page_last": 1296, "abstract": null, "full_text": "A recipe for optimizing a time-histogram\n\nHideaki Shimazaki Department of Physics, Graduate School of Science Kyoto University Kyoto 606-8502, Japan shimazaki@ton.scphys.kyoto-u.ac.jp Shigeru Shinomoto Department of Physics, Graduate School of Science Kyoto University Kyoto 606-8502, Japan shinomoto@scphys.kyoto-u.ac.jp\n\nAbstract\nThe time-histogram method is a handy tool for capturing the instantaneous rate of spike occurrence. In most of the neurophysiological literature, the bin size that critically determines the goodness of the fit of the time-histogram to the underlying rate has been selected by individual researchers in an unsystematic manner. We propose an objective method for selecting the bin size of a time-histogram from the spike data, so that the time-histogram best approximates the unknown underlying rate. The resolution of the histogram increases, or the optimal bin size decreases, with the number of spike sequences sampled. It is notable that the optimal bin size diverges if only a small number of experimental trials are available from a moderately fluctuating rate process. In this case, any attempt to characterize the underlying spike rate will lead to spurious results. Given a paucity of data, our method can also suggest how many more trials are needed until the set of data can be analyzed with the required resolution.\n\n1\n\nIntroduction\n\nThe rate of spike occurrence, or the firing rate, of a neuron can be captured by the (peri-stimulus) time-histogram (PSTH) [1, 2], which is constructed easily as follows: Align spike sequences to the onset of stimuli, divide time into discrete bins, count the number of spikes that enter each bin, and divide the counts by the bin size and the number of sequences. The shape of a PSTH depends on the choice of the bin size. With too large a bin size, one cannot represent the detailed time-dependent rate, while with too small a bin size, the time-histogram fluctuates greatly and one cannot discern the underlying spike rate. There exists an ideal bin size for estimating the spike rate for each set of experimental data. This important parameter has mostly been selected subjectively by individual researchers. We devised a method of selecting the bin size objectively so that a PSTH best approximates the underlying rate, which is unknown. In the course of our study, we found an interesting paper that proposed an empirical method of choosing the histogram bin size for a probability density function (Rudemo M, (1982) Scandinavian Journal of Statistics 9: 65-78 [3]). Although applicable to a Poisson point process, this theory appears to have rarely been applied to PSTHs. It would be preferable to have a theory in accordance with the procedures of neurophysiological experiments in which a stimulus is repeated to extract a signal from a neuron. Given a set of experimental data, we wish to\n\n\f\nnot only determine the optimal bin size, but also estimate how many more experimental trials should be performed in order to obtain a resolution we deem sufficient. It was revealed by a theoretical analysis that the optimal bin size may diverge for a small number of spike sequences derived from a moderately fluctuating rate [4]. This implies that any attempt to characterize the underlying rate will lead to spurious results. The present method can indicate the divergence of the optimal bin size only from the spike data. Even under such a condition, the present method nevertheless provides an inference on the number of trails that need to be performed in order to obtain a meaningful estimated rate.\n\n2\n\nMethods\n\nWe consider sequences of spikes repeatedly recorded from identical experimental trials. A recent analysis revealed that in vivo spike trains are not simply random, but possess inter-spike-interval distributions intrinsic and specific to individual neurons [5, 6]. However, spikes accumulated from a large number of spike trains recorded from a single neuron are, in the majority, mutually independent. Being free from the intrinsic inter-spike-interval distributions of individual spike trains, the accumulated spikes can be regarded as being derived repeatedly from Poisson processes of an identical time-dependent rate [7, 8]. ^ It would be natural to assess the goodness of the fit of the estimator t to the underlying spike rate t over the total observation period T by the mean integrated squared error (MISE), T 1 ^ MISE E (t - t )2 dt, (1) T0 where E refers to the expectation over different realization of point events, given t . We suggest a method for minimizing the MISE with respect to the bin size . The difficulty of the present problem comes from the fact that the underlying spike rate t is not known. 2.1 Selection of the bin size\n\n^ We choose the (bar-graph) PSTH as a way to estimate the rate t , and explore a method to select the bin size of a PSTH that minimizes MISE in Eq.(1). A PSTH is constructed simply by counting the number of spikes that belong to each bin. For an observation period T , we obtain N = T / intervals. The number of spikes accumulated from all n sequences in the ith interval is counted as ki . The bar height at the ith bin is given by ki /n. Given a bin of width , the expected height of a bar graph for t [0, ] is the time-averaged rate, 1 = t dt. (2) 0 The total number of spikes k from n spike sequences that enter a bin of width obeys a Poisson distribution with the expected number n, p(k | n) = (n) -n e . k!\nk\n\n(3)\n\n^ The unbiased estimator for is given as = k /(n), which is the empirical height of the bar graph for t [0, ]. By segmenting the total observation period T into N intervals of size , the MISE defined in Eq.(1) can be rewritten as N d E 1i 1 ^ t, (4) ( i - t+(i-1) )2 MISE = 0 N =1\n\n^ where i ki /(n). Hereafter we denote the average over those segmented rate t+(i-1) as an average over an ensemble of (segmented) rate functions {t } defined in an interval of t [0, ]: E d 1 ^ MISE = t. (5) ( - t )2 0\n\n\f\nTable 1: A method for bin size selection for a PSTH ( i) ( ii) Divide the observation period T into N bins of width , and count the number of spikes ki from all n sequences that enter the ith bin. Construct the mean and variance of the number of spikes {ki } as, N N 1i 1i k ki , and v (ki - k )2 . N =1 N =1 Compute the cost function, Cn () = (iv) 2k - v . (n)2\n\n( iii)\n\nRepeat i through iii while changing the bin size to search for that minimizes Cn ().\n\n^ The first and second terms are respectively the stochastic fluctuation of the estimator around the expected mean rate , and the temporal fluctuation of t around its mean over an interval of length , averaged over the segments. The second term of Eq.(6) can further be decomposed into two parts, ( . d ( ( d 1 1 2 2 t- - ) t - ) t - + - )2 t = 0 0\n\n^ The expectation E now refers to the average over the spike count, or = k /(n), given a rate function t , or its mean value, . The MISE can be decomposed into two parts, E d d E +1 ( 1 2 ^ - + - t )2 ^ - )2 MISE = ( t - ) t. (6) t= ( 0 0\n\n(7)\n\nThe first term in the rhs of Eq.(7) represents a mean squared fluctuation of the underlying rate t from the mean rate , and is independent of the bin size , because ( T d 1 1 2 2 t= t - ) (t - ) dt. (8) 0 T0 We define a cost function by subtracting this term from the original MISE, ( d 1 2 Cn () MISE - t t - ) 0 . -( E 2 ^ - ) = ( - )2\n\n(9)\n\nthe cost function is transformed into\n\nThis cost function corresponds to the \"risk function\" in the report by Rudemo, (Eq. 2.3), obtained by direct decomposition of the MISE [3]. The second term in Eq.(9) represents the temporal fluctuation of the expected mean rate for individual intervals of period . As the expected mean rate is not an observable quantity, we must replace the fluctuation of the expected mean rate with that of the ^ ^ observable estimator . Using the decomposition rule for an unbiased estimator (E = ), , +( =E =E E 2 ^ ^ ^ ^ (10) - ) ( - )2 ( - + - )2 ( - E )2 Cn () = 2 E ^ ( - )2 -E ^ ^ ( - E )2 . (11)\n\n\f\nDue to the assumed Poisson nature of the point process, the number of spikes k counted in each bin obeys a Poisson distribution: the variance of k is equal to the mean. For the estimated rate defined ^ as = k /(n), this variance-mean relation corresponds to 1^ ^ E ( - )2 = E . n (12)\n\nThe optimal bin size is obtained by minimizing the cost function Cn (): arg min Cn ().\n\n\n^ By incorporating Eq.(12) into Eq.(11), the cost function is given as a function of the estimator , . 2 E^ - E ^ ^ (13) ( - E )2 Cn () = n (14)\n\n^ By replacing the expectation of in Eq.(13) with the sample spike counts, the method is converted into a user-friendly recipe summarized in Table 1. 2.2 Extrapolation of the cost function\n\nWith the method developed in the preceding subsection, we can determine the optimal bin size for a given set of experimental data. In this section, we develop a method to estimate how the optimal bin size decreases when more experimental trials are added to the data set. Assume that we are in possession of n spike sequences. The fluctuation of the expected mean rate ( i ^ - )2 n Eq.(10) is replaced with the empirical fluctuation of the time-histogram n using the ^ ^ decomposition rule for the unbiased estimator n satisfying E n = , +( =E =E E . ^ ^ ^ ^ - )2 (15) (n - )2 (n - + - )2 (n - E n )2\n\nThe expected cost function for m sequences can be obtained by substituting the above equation into Eq.(9), yielding . -E +E E ^ ^ ^ ^ (16) (n - E n )2 (n - )2 Cm (|n) = (m - )2 Using the variance-mean relation for the Poisson distribution, Eq.(12), and ^ E (m - )2 = we obtain Cm (|n) = 1 1 1 ^ ^ E m = E n , m m 1 E ^ n + Cn () , (17)\n\n1 - mn\n\n\n\n(18)\n\n^ where Cn () is the original cost function, Eq.(13), computed using the estimators n . By replacing the expectation with sample spike count averages, the cost function for m sequences can be extrap olated as Cm (|n) with this formula, using the sample mean k and variance v of the numbers of spikes, given n sequences and the bin size . The extrapolation method is summarized in Table 2. It may come to pass that the original cost function Cn () computed for n spike sequences does not have a minimum, or have a minimum at a bin size comparable to the observation period T . In such a case, with the method summarized in Table 2, one may estimate the critical number of sequences nc above which the cost function has a finite bin size , and consider carrying out more experiments to obtain a reasonable rate estimation. In the case that the optimal bin size exhibits continuous divergence, the cost function can be expanded as 1 1 1 1 Cn () - + u 2, (19) n nc where we have introduced nc and u, which are independent of n. The optimal bin size undergoes a phase transition from the vanishing 1/ for n < nc to a finite 1/ for n > nc . In this case, the inverse optimal bin size is expanded in the vicinity of nc as 1/ (1/n - 1/nc ). We can\n\n\f\nTable 2: A method for extrapolating the cost function for a PSTH (A) Construct the ex1rapolated c st function, t o k 1 - + Cn (), Cm (|n) = m n n2 using the sample mean k and variance v of the number of spikes obtained from n sequences of spikes. Search for that minimizes Cm (|n). m Repeat A and B while changing m, and plot 1/ vs 1/m to search for m the critical value 1/m = 1/nc above which 1/ practically vanishes. ^ m\n\n(B) (C)\n\n^m estimate the critical value nc by applying this asymptotic relation to the set of estimated from ^ Cm (|n) for various values of m: 1 . 1 1 - (20) m nc ^ m It should be noted that there are cases that the optimal bin size exhibits discontinuous divergence from a finite value. Even in such cases, the plot of {1/m, 1/ } could be useful in exploring a discontinuous transition from nonvanishing values of 1/ to practically vanishing values. 2.3 Theoretical cost function\n\nIn this section, we obtain a \"theoretical\" cost function directly from a process with a known underlying rate, t , and compare it with the \"empirical\" cost function which can be evaluated without knowing the rate process. Note that this theoretical cost function is not available in real experimental conditions in which the underlying rate is not known. ^ The present estimator k /(n) is a uniformly minimum variance unbiased estimator (UMVUE) of , which achieves the lower bound of the Cramer-Rao inequality [9, 10], -1 - k 2 log p (k |) 2 ^ . (21) = p (k |) E ( - ) = 2 n\n=0\n\nwhich can be identified with Eq.(19) with parameters given by (t) dt , nc = - |t|(t) dt. u=\n-\n\nwhere is the mean rate, and (t) is the autocorrelation function of the rate fluctuation, t - . Based on the symmetry (t) = (-t), the cost function can be rewritten as 1 Cn () = -2 ( - |t|)(t) dt n - 1 1 |t|(t) dt, (23) - (t) dt + 2 n - - (24) (25)\n\nInserting this into Eq.(9), the cost function is represented as = ( 2 Cn () = - - ) n 1 (t1 - t2 ) dt1 dt2 , - n 2 0 0\n\n(22)\n\n\f\nB\n\nUnderlying rate, 60\n\nt\n\n30 0\n\nA\nCost function, 200\n\n0\n\n1\n\n2\n\nC\n\nSpike Sequences\n\n100\n\nEmpirical cost function Theoretical cost function\n\n0\n\n1\n\n2\n\n^\n\nD\n0 120\n\nHistograms,\n\nt\n\n60\n\n0 -100 60\n\n30 0 0.1 0.2 0.3 0.4 0.5 0 60\n\n30\n\n0 0 1 Time, t 2\n\nFigure 1: A: (Dots): The empirical cost function, Cn (), computed from spike data according to the method in Table 1. (Solid line): The \"theoretical\" cost function computed directly from the underlying fluctuating rate, with Eq.(22). B: (Above): The underlying fluctuating rate t . (Middle): Spike sequences derived from the rate. (Below): Time-histograms made using three types of bin sizes: too small, optimal, and too large. Model parameters: the number of sequences n = 30; total observation period T = 30 [sec]; the mean rate = 30 [1/s]; the amplitude of rate fluctuation = 10 [1/s]; time scale of rate fluctuation = 0.05 [s].\n\n3\n\nResults\n\nOur first objective was to develop a method for selecting the ideal bin size using spike sequences derived repeatedly from Poisson processes, all with a given identical rate t . The MISE of the PSTH from the underlying rate is minimized by minimizing the cost function Cn (). Figure 1A displays the cost function computed with the method summarized in Table 1. This \"empirical\" cost function is compared with the \"theoretical\" cost function Eq.(22) that is computed directly from the underlying rate t . The figure exhibits that the \"empirical\" cost function is consistent with the \"theoretical\" cost function. The time-histogram constructed using the optimal bin size is compared with those constructed using non-optimal bin sizes in Figs. 1B, demonstrating the effectiveness of the present method of bin size selection. We also tested a method for extrapolating the cost function. Figures 2A and B demonstrate the extrapolated cost functions for several sequences with differing values of m and the plot of {1/m, 1/ } for estimating the critical value 1/m = 1/nc , above which 1/ practically van^ ishes. Figure 2C depicts the critical number nc estimated from the smaller or larger numbers of ^ spike sequences n. The empirically estimated critical number nc approximates the theoretically ^ predicted critical number nc computed using Eq.(24). Note that the critical number is correctly estimated from the small number of sequences, with which the optimal bin size practically diverges (n < nc ).\n\n4\n\nSummary\n\nWe have developed a method for optimizing the bin size, so that the PSTH best represents the (unknown) underlying spike rate. For a small number of spike sequences derived from a modestly\n\n\f\nExtrapolated cost function\n\nEstimated optimal bin size\n\nA\n10\n\nB\n12\n\nm=10 5\n\nm=20 0 m=30 -5 0 2 4 6 8 10\n\n6\n\n0 0.02 0.06 1/m 0.1\n\nC\n40\n\n^ Estimated critical number, nc\n\n30\n\n20\n\n10\n\n0 0 10 20 30 40\n\nNumber of sequences, n\n\nFigure 2: A: Extrapolated cost functions Cm (|n) plotted against 1/ for several numbers of sequences m = 10, 20 and 30 computed from n = 10 sample sequences. B: The plot of {1/m, 1/ } used for estimating the critical value 1/m = 1/nc , above which 1/ practically vanishes. C: The ^ number of spike sequences n used to obtain the extrapolated cost function Cm (|n) and an estimated critical number nc . Model parameters: the number of sequences n = 10; total observation ^ period T = 30 [sec]; the mean rate = 30 [1/s]; the amplitude of rate fluctuation = 4 [1/s]; time scale of rate fluctuation = 0.05 [s]. The theoretical critical number is computed with Eq.(24), giving nc = 21.1 for the present underlying fluctuating rate. This theoretical nc is depicted as the horizontal dashed line.\n\nfluctuating rate, the cost function does not have a minimum, implying the uselessness of the rate estimation. Our method can nevertheless extrapolate the cost function for any number of spike sequences, and suggest how many trials are needed in order to obtain a meaningful time-histogram with the required accuracy. The suitability of the present method was demonstrated by application to spike sequences generated by time-dependent Poisson processes. Acknowledgements This study is supported in part by Grants-in-Aid for Scientific Research to SS from the Ministry of Education, Culture, Sports, Science and Technology of Japan (16300068, 18020015) and the 21st Century COE \"Center for Diversity and Universality in Physics\". HS is supported by the Research Fellowship of the Japan Society for the Promotion of Science for Young Scientists.\n\nReferences\n[1] E. D. Adrian. The Basis of Sensation: The Action of the Sense Organs. W.W. Norton, New York, 1928. [2] G. L. Gerstein and N. Y. S. Kiang. An approach to the quantitative analysis of electrophysiological data from single neurons. Biophysical Journal, 1(1):1528, 1960. [3] M. Rudemo. Empirical choice of histograms and kernel density estimators. Scandinavian Journal of Statistics, 9(2):6578, 1982.\n\n\f\n[4] S. Koyama and S. Shinomoto. Histogram bin width selection for time-dependent poisson processes. Journal of Physics A-Mathematical and General, 37(29):72557265, 2004. [5] S. Shinomoto, K. Shima, and J. Tanji. Differences in spiking patterns among cortical neurons. Neural Computation, 15(12):28232842, 2003. [6] S. Shinomoto, Y. Miyazaki, H. Tamura, and I. Fujita. Regional and laminar differences in in vivo firing patterns of primate cortical neurons. Journal of Neurophysiology, 94(1):567575, 2005. [7] D. L. Snyder. Random Point Processes. John Wiley & Sons, Inc., New York, 1975. [8] D. J. Daley and D. Vere-Jones. An Introduction to the Theory of Point Processes. SpringerVerlag, New York, USA, 1988. [9] R. E. Blahut. Principles and practice of information theory. Addison-Wesley, Reading, Mass, 1987. [10] T. M. Cover and J. A. Thomas. Elements of Information Theory. John Wiley & Sons, Inc., New York, 1991.\n\n\f\n", "award": [], "sourceid": 3140, "authors": [{"given_name": "Hideaki", "family_name": "Shimazaki", "institution": null}, {"given_name": "Shigeru", "family_name": "Shinomoto", "institution": null}]}