# Confusion over probabilities and densities in a Bayesian Data Analysis textbook question

In Gelman's "Bayesian Data Analysis" question 1.5a), we are asked to estimate the probability of a tie in an election. The question:

Probability assignment: the 435 U.S. Congressmembers are elected to two-year terms; the number of voters in an individual congressional election varies from about 50,000 to 350,000 . We will use various sources of information to estimate roughly the probability that at least one congressional election is tied in the next national election.

Use any knowledge you have about U.S. politics. Specify clearly what information you are using to construct this conditional probability, even if your answer is just a guess.

and the solution give here states that:

For a given Congressional election, let $$n$$ be the total number of votes cast and $$y$$ be the number received by the candidate from the Democratic party. If we assume (as a first approximation, and with no specific knowledge of this election), that $$y / n$$ is uniformly distributed between $$30 \%$$ and $$70 \%$$, then $$\operatorname{Pr}(\text { election is tied } \mid n)=\operatorname{Pr}(y=n / 2)=\left\{\begin{array}{ll} \frac{1}{0.4 n} & \text { if } n \text { is even } \\ 0 & \text { if } n \text { is odd } \end{array} .\right.$$

If we suppose that $$y$$ is uniformly distributed with $$U[0.3n, 0.7n]$$ conditional on a specific value of n, then $$\frac{1}{0.4n}$$ is the probability density function. At a specific point, the continuous distribution has probability 0. How to reconcile this with the probability of a specific event $$y=\frac{n}{2}$$ in the solution?

• It might be illuminating to realize that $y$ does not actually have a continuous distribution, because it must be a rational number with a denominator no larger than 350,000.
– whuber
Commented Mar 25, 2022 at 16:50
• Fair point. But unless I'm mistake somehow, a discrete uniform random variable over the rational interval is not mathematically valid? So I'm still unsure of how to arrive at their solution.
– shem
Commented Mar 25, 2022 at 17:12
• First, these are not all the rational numbers: it's a subset of at most $350000^2$ of them. Second, it is mathematically valid to define a discrete probability distribution over all rational numbers in an interval (and, by an easy extension, over all rational numbers): here's an example. Third, my point is that you can determine how to use a density in a probability calculation by contemplating what it's really trying to model. An example of that line of thinking is at stats.stackexchange.com/a/397166/919.
– whuber
Commented Mar 25, 2022 at 17:44
• Thank you for the references and clarification. While I haven't digested them, for future reference I realised that 0.3n and 0.7n are necessarily integers and so $\frac{1}{0.4n}$ is the correct probability.
– shem
Commented Mar 25, 2022 at 18:44
• If you solved your problem, you can self-answer (in the answer box). Commented Nov 16, 2022 at 19:13