Probability of alarm being valid (Bayes' theorem). I have the following problem: 
your box is achieving a false positive rate of 0.01 and a false negative rate of
0.001. What fraction of the alarms that your box generates are valid alarms?
I am trying to figure this out, but I am having trouble understanding how to set this problem up. My initial thoughts were to set the problem as such:
P(valid|alarm) = (P(alarm|valid) * P(Valid))/ ((P(alarm|valid) *  P(Valid) + (P(not valid|alarm) * P(no alarm))

where (and this is where I get confused): 
P(valid) = .99
P(no alarm) = .001

I am not sure what my values/ how to structure this in a logical sense. I think I am confusing what P(valid) and P(alarm|valid) would be. A guide in the right direction would be appreciated. I am new to bayes theorem so I am still trying to wrap my head around it. 
 A: Drawing a tree diagram, starting with whether there is a problem before branching out to whether the alarm sounds (valid alarms are then alarms that sound when there is indeed a problem).
A false positive means that the alarm sounds when there is no problem. That is, $P(\textrm{alarm} | \textrm{no problem}) = 0.01$.
Meanwhile, a false negative means that the alarm does not sound when there is a problem. That is, $P(\textrm{no alarm} | \textrm{problem}) = 0.001$.
The probability we want, that is the fraction of alarms that are valid, is then the conditional probability $P(\textrm{problem} | \textrm{alarm})$.
A: What fraction of the alarms that your box generates are valid alarms?
First, you note that you wish to determine which of the alarms that are generated, are valid. You know that it generates false positives at a rate of $0.01$. In other words, it is valid at a rate of $.99$. The fraction of the alarms that your box generates that are valid is $\frac{99}{100}$.
The way you have phrased the question has nothing to do with Baye's Theorem. If instead, it concerned all the times when it gave you the correct response (that is, including when the alarm is not supposed to turn on), then you would apply Baye's Theorem.
