I'm trying to calculate a likelihood ratio test, but some of the units in the calculation don't make sense to me.
I have a toy 1-dimensional X-meters-long photon detector, and I'm trying to calculate the likelihood that a light is nearby and where it is. The detector reports the x position of where each photon was detected along its length.
In this toy,
- the null flux model $M_n$ is a flat background flux of Y photons/meter, and
- the alternate flux model $M_a$ is the flat background plus a gaussian light source at some position along the detector, also in photons/meter.
The flux models are plotted here:
The likelihood of each model is something like:
$ \log(Likelihood) = N_{pred} - \sum_i \log( P_i ) $
where $N_{pred}$ is the total number of photons predicted by the model, $\sum_i$ is a sum over each detected photon, and $P_i$ is the probability of detecting a photon at the x coordinate where each photon was detected with the model. This is roughly following the likelihood math used in arxiv 1606.00393.
For calculating $N_{pred}$, I can just integrate the specific (null or alternate) flux model $M$ over the length of the detector:
$ N_{pred} = \int_{x_{min}}^{x_{max}} M \, dx $
Then the model units of photons/meter result in $N_{pred}$ having units of photons, which makes sense.
With Poisson statistics and an unbinned likelihood (so the Poisson $k=0$ or $1$), the probability $P_i$ is something like:
$ P_i(x) = \lambda(x) \, e^{-\lambda(x)} = M(x) \, e^{-M(x)} $
where $\lambda(x)$ is the average number of photons expected by the (null or alternate) model at position x.
What confuses me is that:
- the flux model $M(x)$ is in units of photons/meter, but
- in the $P_i(x)$ Poisson probability, the $\lambda(x)$ should be an average number of photons, so it should have units of photons.
I was pretty sure the Poisson $\lambda$ was supposed to be an average or expected number of photons (or counts or occurrences) of some event happening, rather than the counts/distance my math is trying use.
I talked it over with ChatGPT, and it suggested I could integrate $M$ over a tiny length centered on each photon's x position, then divide by the tiny length, but that would give a $\lambda$ of (photons/meter) * meter / meter, which doesn't seem to fix the units issue.
Some possible explanations:
- I've made a small mistake somewhere involving units, or
- I've made a large mistake somewhere involving the likelihood setup, or
- there's some hand-wavy units shenanigans happening ("of course taking a log of a likelihood is totally unit safe..."), or
- its fine to use photons/meter as $\lambda$, and I've reached Semantic satiation with this problem.
What are the right units for $\lambda(x)$ in $P_i(x)$, and how do I get there from $M(x)$?