2
$\begingroup$

I am trying to convert state-level poll results for 2012 U.S. presidential election into state-level probabilities of each candidate winning. To achieve that, I am using the logistic function, which conveniently goes to 0 or 1 as poll results deviate from 50%, and also makes the probability of each candidate winning a state equal to the probability of the other candidate losing that state.

As a reminder, the logistic function is:

$ P(x) = \frac{1}{e^{-x} + 1} $

(NOTE: To match the domains of poll results ($p \in [0, 1]$) and logistic function ($x \in [-\infty, \infty]$), I use the tangent function: $x = tan(10*p/\pi - \pi/2)$, which also conveniently sends $p=50\%$ to $x=0$, the center of the logistic function. I'm not kidding! But don't worry about this unless you have a better suggestion off the top of your head.)

My question is how to incorporate "sample size" into the logistic function, $P(x)$, so that its sharpness around center reflects what percentage of total population (or likely voters) has been polled.

I am thinking that if I could write the confidence interval as a function of sample size, I could divide $x$ by the length of that interval and thus adjust the sharpness of the logistic function.

$\endgroup$
  • $\begingroup$ Do you have any basis at all to convert poll results to probabilities? What is it? $\endgroup$ – whuber Oct 29 '12 at 19:15
  • $\begingroup$ I would like to be able to adjust the probability distribution function according to sample size of polls. Do you think I can achieve this easily without going through that extra step? $\endgroup$ – Tolga Yilmaz Oct 30 '12 at 1:00
  • $\begingroup$ I really can't figure out what you're trying to do from this description. Probability distribution of what? Unless you assume a prior probability (which can be updated from the poll results), there is no legitimate way to deduce a probability description of the chances of winning from the results of a poll. Confidence intervals say nothing about such a probability distribution either. And the use of the logistic function is opaque to me: what principle suggests it would be appropriate in this context? $\endgroup$ – whuber Oct 30 '12 at 1:05
  • $\begingroup$ I don't think poll results reflect probabilities of winning. If a candidate has 70% of voters according to the polls, his probability of winning is probably much closer to 1. If we could be "sure" a candidate had 51% of voters in a state, we could declare his probability of winning that state is 1. So, I need a way of converting poll results into actual probabilities using poll sample sizes. A function that assigns to 51% in polls a higher probability of winning (and simultaneously to 49% a higher probability of losing) as sample size increases seems like the only way to go to me. $\endgroup$ – Tolga Yilmaz Oct 30 '12 at 20:26
  • $\begingroup$ Next: I chose the logistic function because (1) its domain is easy to map into from the range of poll results, (2) its range is between 0 and 1, which makes it easy to interpret as a probability, and (3) it's "antisymmetric" in the sense that the probability of each candidate winning is always equal to the probability of the other candidate losing, no matter how they share current poll results (53-47, or 75-25, etc). And frankly, I don't know any other function that comes close to these properties, and I am averse to making up my own :) $\endgroup$ – Tolga Yilmaz Oct 30 '12 at 20:43
3
$\begingroup$

First, you are making several assumptions here, not necessarily bad assumptions, you should just be honest about the assumptions and consider how you might expand things to deal with more general cases where some of the assumptions might not be true. These assumptions include that you only have 2 possible candidates, that the sample that is polled represents those who will actually vote, that people do not lie in the poll (or change their minds, etc.)

I think that I would approach this using Bayesian statistics. The unknown piece of information that you want is the proportion of voters who will vote for candidate A (if that is over 0.5 then A wins). Start with a prior distribution on this proportion, probably fairly disperse such as a uniform, or a beta that is symmetric about 0.5 and does not concentrate too much too close to 0.5. Then assuming that the poll represents a random sample from the population of people who will vote (and they don't lie, change their minds, say "undecided", etc.) we can consider the results from the poll to be a binomial. Combine this with the prior to get a posterior distribution and you will be able to calculate the information of interest. The probability of A winning is the area under the posterior distribution to the right of 0.5. The sharpness of the posterior will depend on the sample size of the poll like you want.

$\endgroup$
0
$\begingroup$

Instead of the logistic function, I would suggest using the Normal cumulative distribution function $ ncdf()$ in the following manner:

  • $N$ = sample size (e.g. 100)
  • $\bar p$ = sample proportion (e.g. 165/300 = 55%)
  • $\alpha(N, \bar p) = ncdf ( \frac{\bar p-.5}{\sqrt{\bar p (1-\bar p)/N}} )$

The function $\alpha(N, \bar p)$ has the properties you are looking for:

  • It has the sample size $N$ and the sample proportion $\bar p$ as parameters
  • Its range is between 0 and 1 (it's a probability)
  • It is "odd" $\alpha(N, 1- \bar p) = 1 - \alpha(N, \bar p)$, or equivalently, $\alpha(N, \bar p) + \alpha(N, 1- \bar p) = 1$
  • Take an numerical example: $N$=100 and $\bar p$=55%, the probability is 84%
  • With $N$=300 and $\bar p$=55%, the probability is 96% (increases with the sample size)
  • With $N$=100 and $\bar p$=60%, the probability is 98% (increases with poll results deviating from 50%)
  • With $\bar p$ = 50%, the probability is 50%, whatever the sample size

Explanation and disclaimer:

  • I cannot give any statistical justification for the formula (maybe there is one, maybe there is none)
  • It was inspired to me by the textbook formula $\bar p +/- z * \sqrt { \bar p (1-\bar p)/N)}$, where $\alpha = ncdf(z)$ often used in the computation of confidence intervals
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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