1
$\begingroup$

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: flux model plot

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)$?

$\endgroup$
6
  • $\begingroup$ Does the detector have a finite spatial resolution? If so, then $N_{pred} = \sum_i M_i$ and $M_i$ has units of photons (i.e. a count which is dimensionless). If not, then $P(x)$ is not a (dimensionless) probability but a probability density function which has units of 1/length, since $\int P(x) \mathrm{d}x$ is the probability. $\endgroup$
    – abeta201
    May 19 at 7:33
  • $\begingroup$ Do you know that for "many photons" per detector the Poisson is well-approximated by a normal distribution? Why is this gaussian approximation not applicable? Would this solve your issue? $\endgroup$
    – Semoi
    May 19 at 18:40
  • $\begingroup$ @abeta201 in this toy, the gaussian is the spatial resolution, which has some width smaller than the length of the detector. The light source is originally a dirac delta, but then it is convolved with the detectors spatial resolution (a gaussian) to get a gaussian. I'm pretty confidant Npred is the integral of the model, since its defined that way in equation 2 of arxiv 1606.00393, so I'm not too concerned about it. I'm pretty sure M(x) has units of photons/meter, which is why this is confusing to me. (Though I may have misunderstood your comment). $\endgroup$ May 19 at 22:26
  • $\begingroup$ @Semoi That might work, though in this toy (and the larger system this toy is trying to model) there can be many (>1000) photons detected or only a handful (<10), so I can't rely on that approximation. $\endgroup$ May 19 at 22:27
  • $\begingroup$ I have made an example diagram of the two flux models as I understand them, with the x axis along the detector: model fluxes plot $\endgroup$ May 19 at 22:34

2 Answers 2

1
$\begingroup$

Since you defined $$ N = \int_{-\infty}^{\infty} dx M(x) $$ where $N$ is the number of photons, then indeed $M$ has units of photons / meter.

The Poisson distribution gives a probability that $N$ counts will be observed in a given interval. So the Poisson distribution is dimensionless. (you can easily covert a dimensionless probability distribution to one with units of photons by multiplying by the total number of photons).

Now, you've written the Poisson distribution as $$ P_i(x) = \lambda(x) e^{- \lambda(x)} \ \ {\rm incorrect} $$ This does not look like the Poisson distribution to me. The pdf of the Poisson distribution for $k=1$ gives the probability of finding one photon in an interval $\Delta x$, given that the rate for finding events is $1/\gamma$, is $$ P_i(x) = (\gamma \Delta x) e^{-\gamma \Delta x} $$ Now in your case, the rate $M(x)$ is itself spatially dependent. If the rate of change of $M(x)$ near some reference point $x_0$ is slow, then you could approximate $\gamma \approx M(x_0)$ and you could express the probability of detecting a photon near $x_0$ in terms of a Poisson distribution $$ P_i(x) = (M(x_0) \Delta x) e^{- M(x_0) \Delta x} $$

However, if $M(x)$ is varying, then you will need to be more careful. According to this stack exchange answer, if the rate parameter varies in time, then first one computes $N_{12} = \int_{x_1}^{x_2} M(x) dx$, then the the probability of getting one count between times $t_1$ and $t_2$ is given by the Poisson distribution
$$ P_i(x) = N_{12} e^{- N_{12} } $$ (While this seems plausible, you may want to find another source for this claim about a Poisson distribution with varying rate parameter $\lambda(x)$ if you're planning to use this in homework or research).

As a sanity check, in the limit that $M(x) \approx M(x_0)$ (a constant) over the range $[x_1, x_2]$, then $N_{12} \approx M(x_0) (x_2 - x_1) = M(x_0) \Delta x$, which recovers the result we had before.

Finally, as unsolicited advice, don't ask chat GPT for detailed help on physics calculations beyond introductory physics. With advanced physics and math it is very easy to be subtly wrong. You want to make sure you are learning from a reliable source which has been vetted, so you don't get led down a wrong path.

$\endgroup$
2
  • $\begingroup$ The point you made about $\lambda = M(x_0)*\delta x$ was right, I think, but the way to get from $M(x)$ to $\lambda$ is the other half of the problem, which I explain below. $\endgroup$ May 22 at 21:28
  • $\begingroup$ @radioactive.fade In general $\lambda = \int_{x_1}^{x_2} dx M(x)$, at least according to the MSE answer I linked. I think you can derive this by taking a superposition of $N$ Poisson processes (in which case the rates add), in the limit $N\rightarrow \infty$. $\endgroup$
    – Andrew
    May 23 at 18:39
1
$\begingroup$

I talked with another physicist who described a log-likelihood in their thesis. Like @Andrew said, the poisson probability for 1 event in a small bin is

$ P_i = M(x)\Delta x e^{-M(x)\Delta x} $

But it turns out that, in the log likelihood math, the $\Delta x$ pops out of the poisson probability as $log(\Delta x)$. This term can then be dropped, because it does not change the value of the free parameter that provides the maximum log likelihood.

The dropping of these terms is shown in Equation 1.11 of the thesis:

Diffuse $\gamma$-ray Emission Observed by the Fermi Large Area Telescope massive stars, cosmic rays and the census of the interstellar medium in the Galaxy, Tibaldo, 2011

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.