I'm putting together prevalence estimates and CIs for the results of a stratified SRS survey, for which I've already computed weights. The strata are 5 different regions, each observed over time, and the outcome is binary. Currently I'm putting together a pooled estimate and state-level estimates for each sampling frame using:

for (w in unique(df$window)) {
  dfw = df[df$window == w, ]
  wsvy = svydesign(ids=dfw$psu, strata=dfw$region, weights=dfw$pweight, data=dfw, fpc=dfw$N_window)
  pooled_prop = svyciprop(~I(y > 0), wsvy, level=0.95)
  state_prop = svyby(~I(y > 0), ~region, design=wsvy, svyciprop, vartype="ci", level=0.95) %>% mutate_if(is.numeric, round, digits=4)
  print(round(as.vector(pooled_prop), digits=4))
  print(round(attr(pooled_prop, "ci"), digits=4))

This is all well and good, except that for a handful of sample frames, there were regions with 0 instances of the outcome variable (i.e. the observed proportion = 0). So a point estimate of 0 is fine here, but I want to also have reasonable confidence intervals, which are apparently not possible using svyciprop

Does anyone know a method in R for producing confidence intervals for surveys when the observed proportion is 0 or 1?


1 Answer 1


In general, the problem is that it's hard to bound the design effect at all when all the observed values are zero (which is why svyciprop doesn't).

When you only have stratified element sampling and no clustering it should be possible, though it's still not easy. Suppose, for example, that there are non-zero values in the population, but only in one stratum. Suppose that sample size in that stratum is $n_1$ from a population $N_1$. The rule of three says a good upper confidence limit on the proportion $p_1$ in that stratum is $3/n_1$, which translates to $(N_1/N)(3/n_1)$ in the population, or $(3/N)(N_1/n_1)$.

I think this bound, applied to the stratum with the lowest sampling fraction, gives the worst case (at least if all the sampling fractions are small), so I think that's the best upper confidence limit you can produce if you don't know anything about how the probabilities might differ across strata.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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