Explanation of confidence interval in example in Gelman and Hill Gelman and Hill have an example in their text where they analyze this birth related dataset.  I understand the idea behind the analysis, but I can't verify the actual confidence interval  that they get:
Total proportion girls:                                              .4857
Observed standard deviation of proportion girls:                     .0064
Expected s.d. of proportion girls:  sqrt((.486)(1-.486)/3903) =      .0080
95% conf. interval for observed s.d. (based on chi^2 with 23 d.f.): (.006, .010)

I'm familiar with the approach to generate the confidence interval outlined here , but they seem to be using a different method.  Can anyone point me to the technique they use?  
 A: Now that I looked at the observed birth data, I see that there are 24 months of data.  For each month you have a sample proportion of girl births.  If we assume that births are independent of month then each estimate is approximately normal with mean the true p and variance p(1-p)/n$_i$ where n$_i$ is the actual number of girl births in month i.  So you have 24 independent estimates of  p.  Each one normally distributed.  The variances differ slightly becuase of the differences in the n$_i$s.  But since the ns are all close to 3900 we can ignore that difference.  
Now 0.4857 is the overall average of these 24 estimates.  Take the sample variance of these 24 estimates.  If each estimate were exactly normal and independent the variance would be proportional to a chi square random variable with 23 degrees of freedom (1 less than the number of months).  Since the normal approximations are all very good that chi square distribution can be used to get a confidence interval for the variance and then the square root of the end points can be used for the approximate 95% confidence interval for the standard deviation.
I think that what is very interesting about this is the upper endpoint of 0.010.  We see that if we add 0.01 to the estimate of 0.4857 for girls we still get 0.4957 <0.5.  This indicates that we would reject the null hypothesis that p=0.5.  So we have evidence that slightly more girls are born than boys.  The actual hypothesis test though would be gotten by inverting say the 95% confidence interval for p which is [0.4742, 0.4972] (barely excluding 0.5).  I got the CI by subtracting 1.96 (0.0064) from 0.4857 for the lower endpoint and adding that quantity to 0.4857 for the upper endpoint.
A: 10 years late...
However, to calculate the 95% confidence interval, the following R code is what you need:
expected_std = 0.0080
df = 24 - 1

q95 = sqrt(
  (df*expected_std^2) / qchisq(c(0.025, 0.975), df, lower.tail = FALSE))

Essentially, one scales the expected variance (expected_std^2) by $\frac{df}{\chi^2}$ where $\chi^2$ are the values given by the $\chi^2$ distribution at the quantiles of interest: (0.025, 0.975). We then take the square root to convert from variance to standard deviation.
A useful resource.
