R: [R] proportions confidence intervals

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Mon Jul 12 19:14:52 CEST 2004


You should consider "prop.test" or  "binom.test". 
The problem you will find is that these functions are 
not intended to do what you want but to give you one
confidence interval at a time.

However a starting point could be :

 I<-sample(1:50) #the numerator
 N<-sample(50:200, 50) #the denominator
 conf.intervals<-t( sapply(
	mapply(binom.test, SIMPLIFY=F, x=I, n=N), "[[", "conf.int") )

 cbind(I, N, P=I/N, conf.int)



best whishes, 

Stefano


-----Messaggio originale-----
Da: Darren Shaw [mailto:Darren.Shaw at ed.ac.uk]
Inviato: lunedì 12 luglio 2004 17.45
A: r-help at stat.math.ethz.ch
Oggetto: [R] proportions confidence intervals


Dear R users

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

many thanks


Darren Shaw



-----------------------------------------------------------------
Dr Darren J Shaw
Centre for Tropical Veterinary Medicine (CTVM)
The University of Edinburgh
Scotland, EH25 9RG, UK

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list