# [R] proportions confidence intervals

Clint Bowman clint at ecy.wa.gov
Mon Jul 12 20:24:39 CEST 2004

```It seems to me that a transformation is in order since [0,1] can't
possibly contain a normal distribution without cutting off both tails.

On Mon, 12 Jul 2004, Rolf Turner wrote:

>
> Darren Shaw wrote:
>
> > this may be a simple question - but i would appreciate any thoughts
> >
> > does anyone know how you would get one lower and one upper confidence
> > interval for a set of data that consists of proportions.  i.e. taking a
> > usual confidence interval for normal data would result in the lower
> > confidence interval being negative - which is not possible given the data
> > (which is constrained between 0 and 1)
> >
> > i can see how you calculate a upper and lower confidence interval for a
> > single proportion, but not for a set of proportions
>
>
> (1) Your question appears to be a bit ``off topic''.  I.e. it is
> implement methodology in R.
>
> (2) You need to make the scenario clearer.  What do your data
> actually consist of?  What are you assuming?
>
> The only reasonable scenario that springs to mind (perhaps this is
> merely indicative of poverty of imagination on my part) is that you
> have a number of ***independent*** samples, each yielding a sample
> proportion, and each coming from the same population (or at least
> from populations having the same population proportion ``p''.  I.e.
> you have p.hat_1, ..., p.hat_n and from these you wish to calculate a
> confidence interval for p.
>
> You need to know the sample ***sizes*** for each sample.  If you
> don't, you're screwed.  Full stop.  There is absolutely nothing
> sensible you can do.  If you ***do*** know the sample sizes (say k_1,
> ..., k_n) then the problem is trivial.
>
> You have p.hat_j = x_j/k_j for j = 1, ..., n.
>
> Let x = x_1 + ... + x_n  and k = k_1 + ... + k_n.
>
> Form p.hat = x/k.  (I.e. you ***really*** just have one big
> happy sample.)  Then calculate the confidence interval for p
> in the usual way:
>
> 	p.hat +/- (z-value) * sqrt(p.hat * (1 - p.hat)/k)
>
> If this is not the scenario with which you need to cope, then
> you'll have to explain what that scenario actually is.
>
> 				cheers,
>
> 					Rolf Turner
> 					rolf at math.unb.ca
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

--
Clint Bowman			INTERNET:	clint at ecy.wa.gov
Air Quality Modeler		INTERNET:	clint at math.utah.edu
Department of Ecology		VOICE:		(360) 407-6815
PO Box 47600			FAX:		(360) 407-7534
Olympia, WA 98504-7600

```