72 Building a changepoint model
Consider the following twist on the experiment we have been considering where a retinal ganglion cell’s spiking is monitored under constant light. The retina is exposed to constant light, but at some time between the start and end of the experience, the impinging light intensity changes. That is, for \(0 \le t < s\), the retina is exposed to one light intensity, and for \(s \le t \le T\), it is exposed to another. The problem is that you do not know what \(s\) is, and you have to infer it. Your task is to construct a Bayesian model for this situation, complete with prior predictive checks.
This is a simple example of a decoding problem, in which a stimulus is inferred from neuronal signals.
72.1 Solution
In what follows, we assume \(0 \le s \le T\). We can write the spiking rate according to the change point using a Heaviside function as
\[\begin{align} \beta(t) = \beta_1 + (\beta_2 - \beta_1)\theta(t-s). \end{align} \]
The likelihood for the spike times (and the fact that there was no spike between \(t_n\) and \(T\)) is
\[\begin{align} f(\mathbf{t}, T\mid \beta(t)) = \left(\prod_{i=1}^n\beta(t_i)\right)\exp\left[-\int_0^T \mathrm{d}t\,\beta(t)\right]. \end{align} \]
The integral for the above defined \(\beta(t)\) is
\[\begin{align} \int_0^T \mathrm{d}t\,\beta(t) = \beta_1\,s + \beta_2(T-s). \end{align} \]
giving a likelihood of
\[\begin{align} f(\mathbf{t}, T\mid \beta(t)) = \left(\prod_{i=1}^n(\beta_1 + (\beta_2 - \beta_1)\theta(t_i-s))\right)\mathrm{e}^{-\beta_2 T}\,\mathrm{e}^{-(\beta_1 - \beta_2)s}. \end{align} \]
We do not know where on the domain \([0, T]\) that the changepoint lies, so we will assume a Uniform prior for \(s\). We will use weakly informative Gamma priors for the spiking rates. Assuming times are in units of milliseconds (and rates therefore in units of kHz), I will take both \(\beta_1\) and \(\beta_2\) to be Gamma distributed with parameters \(\alpha = 0.65\) and \(\beta = 2.9\) kHz. Thus, the generative model is as follows.
\[\begin{align} &\beta_1 \sim \text{Gamma}(0.65, 2.9),\\[1em] &\beta_2 \sim \text{Gamma}(0.65, 2.9),\\[1em] &s \sim \text{Uniform}(0, T),\\[1em] &f(\mathbf{t}, T\mid \beta_1, \beta_2, s) = \left(\prod_{i=1}^n(\beta_1 + (\beta_2 - \beta_1)\theta(t_i-s))\right)\mathrm{e}^{-\beta_2 T}\,\mathrm{e}^{-(\beta_1 - \beta_2)s}. \end{align} \]