diff --git a/pointprocesses/lecture/pointprocesses.tex b/pointprocesses/lecture/pointprocesses.tex index 7e64f40..1a78dfe 100644 --- a/pointprocesses/lecture/pointprocesses.tex +++ b/pointprocesses/lecture/pointprocesses.tex @@ -107,7 +107,7 @@ are described using the common measures. \rangle)^2 \rangle}$\vspace{1ex} \item \enterm{Coefficient of variation}: $CV_{ISI} = \frac{\sigma_{ISI}}{\mu_{ISI}}$. -\item \enterm{Diffusion coefficient}): $D_{ISI} = +\item \enterm{Diffusion coefficient}: $D_{ISI} = \frac{\sigma_{ISI}^2}{2\mu_{ISI}^3}$. \end{itemize} @@ -294,9 +294,9 @@ The homogeneous Poisson process has the following properties: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Time-dependent firing rate} -So far we discussed stationary spiketrains. The statistical properties +So far we have discussed stationary spiketrains. The statistical properties of these did not change within the observation time (stationary point -processes. Most commonly, however, this is not the case. A sensory +processes). Most commonly, however, this is not the case. A sensory neuron, for example, might respond to a stimulus by modulating its firing rate (non-stationary point process). @@ -304,215 +304,229 @@ How the firing rate $r(t)$ changes over time is the most important measure, when analyzing non-stationary spike trains. The unit of the firing rate is Hertz, i.e. the number of action potentials per second. There are different ways to estimate the firing rate and three -of these methods will are illustrated in \figref{psthfig}. All of +of these methods are illustrated in \figref{psthfig}. All of these have their own justifications and pros- and cons. In the -following we will discuss the methods shown in \figref{psthfig} more +following we will discuss these methods more closely. \begin{figure}[tp] \includegraphics[width=\columnwidth]{firingrates} - \titlecaption{Bestimmung der zeitabh\"angigen - Feuerrate.}{\textbf{A)} Rasterplot eines Spiketrains. \textbf{B)} - Feurerrate aus der instantanen Feuerrate bestimmt. \textbf{C)} - klassisches PSTH mit der Binning Methode. \textbf{D)} Feuerrate - durch Faltung mit einem Gauss Kern bestimmt.}\label{psthfig} + \titlecaption{Estimating the time-dependent firing + rate.}{\textbf{A)} Rasterplot depicting the spiking activity of a + neuron. \textbf{B)} Firing rate calculated from the + \emph{instantaneous rate}. \textbf{C)} classical PSTH with the + \emph{binning} method. \textbf{D)} Firing rate estimated by + \emph{convolution} of the activity with a Gaussian + kernel.}\label{psthfig} \end{figure} -\subsection{Instantane Feuerrate} +\subsection{Instantaneous firing rate} \begin{figure}[tp] \includegraphics[width=\columnwidth]{isimethod} - \titlecaption{Instantane Feuerrate.}{Skizze eines Spiketrains - (oben). Die Pfeile zwischen aufeinanderfolgenden - Aktionspotentialen mit den Zahlen in Millisekunden illustrieren - die Interspikeintervalle. Der Kehrwert des Interspikeintervalle - ergibt die instantane Feuerrate.}\label{instrate} + \titlecaption{Instantaneous firing rate.}{Sketch of the recorded + spiketrain (top). Arrows illustrate the interspike intervals and + number give the intervals in milliseconds. The inverse of the + interspike interval is the \emph{instantaneous firing + rate}.}\label{instratefig} \end{figure} -Ein sehr einfacher Weg, die zeitabh\"angige Feuerrate zu bestimmen ist -die sogenannte \determ[Feuerrate!instantane]{instantane Feuerrate} -(\enterm[firing rate!instantaneous]{instantaneous firing rate}). Dabei -wird die Feuerrate aus dem Kehrwert der Interspikeintervalle, der Zeit -zwischen zwei aufeinander folgenden Aktionspotentialen -(\figref{instrate} A), bestimmt. Die abgesch\"atzte Feuerrate -(\figref{instrate} B) ist g\"ultig f\"ur das gesammte -Interspikeintervall. Diese Methode hat den Vorteil, dass sie sehr -einfach zu berechnen ist und keine Annahme \"uber eine relevante -Zeitskala (der Kodierung oder des Auslesemechanismus der -postsynaptischen Zelle) macht. $r(t)$ ist allerdings keine -kontinuierliche Funktion, die Spr\"unge in der Feuerrate k\"onnen -f\"ur manche Analysen nachteilig sein. Au{\ss}erdem wird die Feuerrate -nie gleich Null, auch wenn lange keine Aktionspotentiale generiert -wurden. +A very simple method for estimating the time-dependent firing rate is +the \enterm[firing rate!instantaneous]{instantaneous firing rate}. The +firing rate can be directly estimated as the inverse of the time +between successive spikes, the interspike-interval +(\figref{instratefig}). + +\begin{equation} + \label{instantaneousrateeqn} + r_i = \frac{1}{T_i} . +\end{equation} + +The instantaneous rate $r_i$ is valid for the whole interspike +interval. The method has the advantage of being extremely easy to +compute and that it does not make any assumptions about the relevant +timescale (of the encoding in the neuron or the decoding of a +postsynaptic neuron). The resulting $r(t)$, however, is no continuous +function, the firing rate jumps from one level to the next. Since the +interspike interval between successive spikes is never infinitely +long, the firing rate never reaches zero despite that the neuron may +not fire an action potential for a long time. \begin{exercise}{instantaneousRate.m}{} - Implementiere die Absch\"atzung der Feuerrate auf Basis der - instantanen Feuerrate. Plotte die Feuerrate als Funktion der Zeit. + Implement a function that computes the instantaneous firing + rate. Plot the firing rate as a function of time. + \note{TODO: example data!!!} \end{exercise} -\subsection{Peri-Stimulus-Zeit-Histogramm} -W\"ahrend die Instantane Rate den Kehrwert der Zeit von einem bis zum -n\"achsten Aktionspotential misst, sch\"atzt das sogenannte -\determ{Peri-Stimulus-Zeit-Histogramm} (\enterm{peri stimulus time - histogram}, \determ[PSTH|see{Peri-Stimulus-Zeit-Histogramm}]{PSTH}) -die Wahrscheinlichkeit ab, zu einem Zeitpunkt Aktionspotentiale -anzutreffen. Es wird versucht die mittlere Rate \eqnref{firingrate} im -Grenzwert kleiner Beobachtungszeiten abzusch\"atzen: +\subsection{Peri-stimulus-time-histogram} +While the \emph{instantaneous firing rate} uses the interspike +interval, the \enterm{peri stimulus time histogram} (PSTH) uses the +spike count within observation windows of the duration $W$. It +estimates the probability of observing a spike within that observation +time. It tries to estimat the average rate in the limit of small +obersvation times \eqnref{psthrate}: \begin{equation} \label{psthrate} r(t) = \lim_{W \to 0} \frac{\langle n \rangle}{W} \; , \end{equation} -wobei die Anzahl $n$ der Aktionspotentiale, die im Zeitintervall -$(t,t+W)$ aufgetreten sind, \"uber trials gemittelt wird. Eine solche -Rate enspricht der zeitabh\"angigen Rate $\lambda(t)$ des inhomogenen -Poisson-Prozesses. +where $\langle n \rangle$ is the across trial average number of action +potentials observed within the interval $(t, t+W)$. Such description +matches the time-dependent firing rate $\lambda(t)$ of an +inhomogeneous Poisson process. -Das PSTH \eqnref{psthrate} kann entweder \"uber die Binning-Methode -oder durch Verfaltung mit einem Kern bestimmt werden. Beiden Methoden -gemeinsam ist die Notwendigkeit der Wahl einer zus\"atzlichen Zeitskala, -die der Beobachtungszeit $W$ in \eqnref{psthrate} entspricht. +The firing probability can be estimated using the \emph{binning + method} or by using \emph{kernel density estimations}. Both methods +make an assumption about the relevant observation time-scale ($W$ in +\eqnref{psthrate}). -\subsubsection{Binning-Methode} +\subsubsection{Binning-method} \begin{figure}[tp] \includegraphics[width=\columnwidth]{binmethod} - \titlecaption{Bestimmung des PSTH mit der Binning Methode.}{Der - gleiche Spiketrain wie in \figref{instrate}. Die grauen Linien - markieren die Grenzen der Bins und die Zahlen geben die Anzahl der Spikes - in jedem Bin an (oben). Die Feuerrate ergibt sich aus dem - mit der Binbreite normierten Zeithistogramm (unten).}\label{binpsth} + \titlecaption{Estimating the PSTH using the binning method.}{ The + same spiketrain as shown in \figref{instratefig} is used + here. Vertical gray lines indicate the borders between adjacent + bins in which the number of action potentials is counted (red + numbers). The firing rate is then the histogram normalized to the + binwidth.}\label{binpsthfig} \end{figure} -Bei der Binning-Methode wird die Zeitachse in gleichm\"aßige -Abschnitte (Bins) eingeteilt und die Anzahl Aktionspotentiale, die in -die jeweiligen Bins fallen, gez\"ahlt (\figref{binpsth} A). Um diese -Z\"ahlungen in die Feuerrate umzurechnen muss noch mit der Binweite -normiert werden. Das ist \"aquivalent zur Absch\"atzung einer -Wahrscheinlichkeitsdichte. Es kann auch die \code{hist()} Funktion zur -Bestimmung des PSTHs verwendet werden. \sindex[term]{Feuerrate!Binningmethode} - -Die bestimmte Feuerrate gilt f\"ur das gesamte Bin (\figref{binpsth} -B). Das so berechnete PSTH hat wiederum eine stufige Form, die von der -Wahl der Binweite anh\"angt. $r(t)$ ist also keine stetige -Funktion. Die Binweite bestimmt die zeitliche Aufl\"osung der -Absch\"atzung. \"Anderungen in der Feuerrate, die innerhalb eines Bins -vorkommen k\"onnen nicht aufgl\"ost werden. Mit der Wahl der Binweite -wird somit eine Annahme \"uber die relevante Zeitskala des Spiketrains -gemacht. +The binning method separates the time axis into regular bins of the +bin width $W$ and counts for each bin the number of observed action +potentials (\figref{binpsthfig} top). The resulting histogram is then +normalized with the bin width $W$ to yield the firing rate shown in +the bottom trace of figure \ref{binpsthfig}. The above sketched +process is equivalent to estimating the probability density. It is +possible to estimate the PSTH using the \code{hist()} method +\sindex[term]{Feuerrate!Binningmethode} + +The estimated firing rate is valid for the total duration of each +bin. This leads to the step-like plot shown in +\figref{binpsthfig}. $r(t)$ is thus not a contiunous function in +time. The binwidth defines the temporal resolution of the firing rate +estimation Changes that happen within a bin cannot be resolved. Thus +chosing a bin width implies an assumption about the relevant +time-scale. \pagebreak[4] \begin{exercise}{binnedRate.m}{} - Implementiere die Absch\"atzung der Feuerrate mit der ``binning'' - Methode. Plotte das PSTH. + Implement a function that estimates the firing rate using the + ``binning method''. The method should take the spike-times as an + input argument and returns the firing rate. Plot the PSTH. \end{exercise} -\subsubsection{Faltungsmethode} +\subsubsection{Convolution method --- Kernel density estimation} \begin{figure}[tp] \includegraphics[width=\columnwidth]{convmethod} - \titlecaption{Bestimmung des PSTH mit der Faltungsmethode.}{Der - gleiche Spiketrain wie in \figref{instrate}. Bei der Verfaltung - des Spiketrains mit einem Faltungskern wird jeder Spike durch den - Faltungskern ersetzt (oben). Bei korrekter Normierung des - Kerns ergibt sich die Feuerrate direkt aus der \"Uberlagerung der - Kerne.}\label{convrate} + \titlecaption{Estimating the firing rate using the convolution + method.}{The same spiketrain as in \figref{instratefig}. The + convolution of the spiketrain with a convolution kernel basically + replaces each spike event with the kernel (top). A Gaussian kernel + is used here, but other kernels are also possible. If the kernel + is properly normalized the firing rate results directly form the + superposition of the kernels.}\label{convratefig} \end{figure} -Bei der Faltungsmethode werden die harten Kanten der Bins der -Binning-Methode vermieden. Der Spiketrain wird mit einem Kern -verfaltet, d.h. jedes Aktionspotential wird durch den Kern ersetzt. -Zur Berechnung wird die Aktionspotentialfolge zun\"achst -``bin\"ar'' dargestellt. Dabei wird ein Spiketrain als -(Zeit-)Vektor dargestellt, in welchem die Zeitpunkte der -Aktionspotentiale als 1 notiert werden. Alle anderen Elemente des -Vektors sind 0. Anschlie{\ss}end wir dieser bin\"are Spiketrain mit -einem Gau{\ss}-Kern bestimmter Breite verfaltet: - \[r(t) = \int_{-\infty}^{\infty} \omega(\tau) \, \rho(t-\tau) \, {\rm d}\tau \; , \] -wobei $\omega(\tau)$ der Filterkern und $\rho(t)$ die bin\"are Antwort -ist. Bildlich geprochen wird jede 1 in $\rho(t)$ durch den Filterkern -ersetzt (Abbildung \ref{convrate} A). Wenn der Kern richtig normiert -wurde (Integral gleich Eins), ergibt sich die Feuerrate direkt aus der -\"Uberlagerung der Kerne (Abb. \ref{convrate} B). \sindex[term]{Feuerrate!Faltungsmethode} - -Die Faltungsmethode f\"uhrt, anders als die anderen Methoden, zu einer -stetigen Funktion was insbesondere f\"ur spektrale Analysen von -Vorteil sein kann. Die Wahl der Kernbreite bestimmt, \"ahnlich zur -Binweite, die zeitliche Aufl\"osung von $r(t)$. Die Breite des Kerns -macht also auch wieder eine Annahme \"uber die relevante Zeitskala des -Spiketrains. +With the convolution method we avoid the sharp edges of the binning +method. The spiketrain is convolved with a \enterm{convolution + kernel}. Technically speaking we need to first create a binary +representation of the spike train. This binary representation is a +series of zeros and ones in which the ones denote the spike. Then this binary vector is convolved with a kernel of a certain width: + +\[r(t) = \int_{-\infty}^{\infty} \omega(\tau) \, \rho(t-\tau) \, {\rm d}\tau \; , \] +where $\omega(\tau)$ represents the kernel and $\rho(t)$ the binary +representation of the response. The process of convolution can be +imagined as replacing each event of the spiketrain with the kernel +(figure \ref{convratefig} top). The superposition of the replaced +kernels is then the firing rate (if the kerel is correctly normalized +to an integral of one, figure \ref{convreffig} +bottom). \sindex[term]{Feuerrate!Faltungsmethode} + +In contrast to the other methods the convolution methods leads to a +continuous function which is often desirable (in particular when +applying methods in the frequency domain). The choice of the kernel +width defines, similar to the bin width of the binning method, the +temporal resolution of the method and thus makes assumptions about the +relevate time-scale. \pagebreak[4] \begin{exercise}{convolutionRate.m}{} - Verwende die Faltungsmethode um die Feuerrate zu bestimmen. Plotte - das Ergebnis. + Implement the function that estimates the firing rate using the + convolution method. The method takes the spiketrain, the temporal + resolution of the recording (as the stepsize $dt$, in seconds) and + the width of the kernel (the standard deviation $\sigma$ of the + Gaussian kernel, in seconds) as input arguments. It returns the + firing rate. Plot the result. \end{exercise} \section{Spike-triggered Average} -Die graphischer Darstellung der Feuerrate allein reicht nicht aus um -den Zusammenhang zwischen neuronaler Antwort und einem Stimulus zu -analysieren. Eine Methode um mehr \"uber diesen Zusammenhang zu -erfahren, ist der \enterm{spike-triggered average} -(\enterm[STA|see{spike-triggered average}]{STA}). Der STA + +The graphical representation of the neuronal activity alone is not +sufficient tot investigate the relation between the neuronal response +and a stimulus. One method to do this is the \enterm[STA|see + spike-triggered average]{spike-triggered average}. The STA \begin{equation} STA(\tau) = \langle s(t - \tau) \rangle = \frac{1}{N} \sum_{i=1}^{N} s(t_i - \tau) \end{equation} -der $N$ Aktionspotentiale zu den Zeiten $t_i$ in Anwort auf den -Stimulus $s(t)$ ist der mittlere Stimulus, der zu einem -Aktionspotential in der neuronalen Antwort f\"uhrt. - -Der STA l\"a{\ss}t sich relativ einfach berechnen, indem aus dem -Stimulus f\"ur jeden beobachteten Spike ein entsprechender Abschnitt -ausgeschnitten wird und diese dann gemittelt werde (\figref{stafig}). +of $N$ action potentials observed at the times $t_i$ in response to +the stimulus $s(t)$ is the average stimulus that led to a spike in the +neuron. The STA can be easily extracted by cutting snippets out of +$s(t)$ that surround the times of the spikes. The resulting stimulus +snippets are then averaged (\figref{stafig}). \begin{figure}[t] \includegraphics[width=\columnwidth]{sta} - \titlecaption{Spike-triggered Average eines P-Typ Elektrorezeptors - und Stimulusrekonstruktion.}{Der STA (links): der Rezeptor - wurde mit einem ``white-noise'' Stimulus getrieben. Zeitpunkt 0 - ist der Zeitpunkt des beobachteten Aktionspotentials. Die Kurve - ergibt sich aus dem gemittelten Stimulus je 50\,ms vor und nach - einem Aktionspotential. Stimulusrekonstruktion mittels - STA (rechts). Die Zellantwort wird mit dem STA gefaltet um eine - Rekonstruktion des Stimulus zu erhalten.}\label{stafig} + \titlecaption{Spike-triggered average of a P-type electroreceptors + and the stimulus reconstruction.}{The neuron was driven by a + ``white-noise'' stimulus (blue curve, right panel). The STA (left) + is the average stimulus that surrounds the times of the recorded + action potentials (40\,ms before and 20\,ms after the + spike). Using the STA as a convolution kernel for convolving the + spiketrain we can reconstruct the stimulus from the neuronal + response. In this way we can get an impression of the stimulus + features that are encoded in the neuronal response (right + panel).}\label{stafig} \end{figure} -Aus dem STA k\"onnen verschiedene Informationen \"uber den -Zusammenhang zwischen Stimulus und neuronaler Antwort gewonnen -werden. Die Breite des STA repr\"asentiert die zeitliche Pr\"azision, -mit der Stimulus und Antwort zusammenh\"angen und wie weit das Neuron -zeitlich integriert. Die Amplitude des STA (gegeben in der gleichen -Einheit wie der Stimulus) deutet auf die Empfindlichkeit des Neurons -bez\"uglich des Stimulus hin. Eine hohe Amplitude besagt, dass es -einen starken Stimulus ben\"otigt, um ein Aktionspotential -hervorzurufen. Aus dem zeitlichen Versatz des STA kann die Zeit -abgelesen werden, die das System braucht, um auf den Stimulus zu -antworten. - -Der STA kann auch dazu benutzt werden, aus den Antworten der Zelle den -Stimulus zu rekonstruieren (\figref{stafig} B). Bei der -\determ[invertierte Rekonstruktion]{invertierten Rekonstruktion} wird -die Zellantwort mit dem STA verfaltet. +From the STA we can extract several pieces of information about the +relation of stimulus and response. The width of the STA represents the +temporal precision with which the neuron encodes the stimulus waveform +and in which temporal window the neuron integrates the (sensory) +input. The amplitude of the STA tells something about the sensitivity +of the neuron. The STA is given in the same units as the stimulus and +a small amplitude indicates that the neuron needs only a small +stimulus amplitude to create a spike, a large amplitude on the +contrary suggests the opposite. The temporal delay between the STA and +the time of the spike is a consequence of the time the system (neuron) +needs to process the stimulus. + +We can further use the STA to do a \enterm{reverse reconstruction} and +estimate the stimulus from the neuronal response (\figref{stafig}, +right). For this, the spiketrain is convolved with the STA as a +kernel. \begin{exercise}{spikeTriggeredAverage.m}{} - Implementiere eine Funktion, die den STA ermittelt. Verwende dazu - den Datensatz \file{sta\_data.mat}. Die Funktion sollte folgende - R\"uckgabewerte haben: + Implement a function that calculates the STA. Use the dataset + \file{sta\_data.mat}. The function expects the spike train, the + stimulus and the temporal resolution of the recording as input + arguments and should return the following information: \vspace{-1ex} \begin{itemize} \setlength{\itemsep}{0ex} - \item den Spike-Triggered-Average. - \item die Standardabweichung der individuellen STAs. - \item die Anzahl Aktionspotentiale, die zur Berechnung des STA verwendet wurden. - \vspace{-2ex} + \item the spike-triggered average. + \item the standard deviation of the STA across the individual snippets. + \item The number of action potentials used to estimate the STA. \end{itemize} + \end{exercise} \begin{exercise}{reconstructStimulus.m}{} - Rekonstruiere den Stimulus mithilfe des STA und der Spike - Zeiten. Die Funktion soll Vektor als R\"uckgabewert haben, der - genauso gro{\ss} ist wie der Originalstimulus aus der Datei + Do the reverse reconstruction using the STA and the spike times. The + function should return the estimated stimulus in a vector that has + the same size as the original stimulus contained in file \file{sta\_data.mat}. \end{exercise}