# Inverting conditional probabilities with bayes

So I'm a bit confused about the bridge between urn type Bayes problems and more complex stuff like categorical distributions and dirichlet priors.

What want to look at is the probability of an exit geofence event on a phone (a circular region in space that the phone monitors) being triggered as a function of velocity. I have a whole bunch of examples of it being triggered, and a bunch more of them being set, then crossed, but not triggered. I get an event when the fences are triggered, so I can easily calculate the velocity then (e.g. $P(velocity | triggered)$) but really what I'd like to know is $P(triggered | velocity)$.

Am I able to just use the urn version of bayes theorem here if I bin my velocity measurements? What I mean is would it just be

$P(triggered|velocity)=\frac{P(velocity|triggered)P(triggered)}{P(velocity)}$

acting on each velocity bin? The way I'd read this is $P(triggered)$ would be the probability that any fence gets triggered (I know how many got set, I know how many got triggered), and P(velocity) is the fraction of all velocities that fall into the velocity bin we care about.

I'm not sure if I'm misunderstanding how to use Bayes theorem completely.

Thank you!

• Would you please provide some links to what you are talking about so as to make it more accessible to a wider audience? – Carl Apr 19 '17 at 2:24

In particular, as the "triggered" is a binary event, you just compute the likelihood ratio of triggering $T$ vs. not triggering $\sim{T}$, and the $p(V)$ factor cancels \begin{align} \frac{p(~~~~T|V)}{p(\sim{T}|V)}=\frac{p(V|~~~~T)}{p(V|\sim{T})}\times\frac{p(~~~~T)}{p(\sim{T})} \end{align} The right hand side is all known, and you can simplify the left hand side using $$p(T|V)+p(\sim{T}|V)=1$$ to solve for $p(T|V)$.