How does confidence interval vary with sample size? 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. 
 A: 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.
A: 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

