[R] Resampling with replacement on a binary (0, 1) dataset to get Cis

lincoln miseno77 at hotmail.com
Thu Dec 1 16:49:09 CET 2011


So, suppose for one specific year (first year over 10) the percentage of
successes deriving from 100 trials with 38 successes (and 62 failures), its
value would be 38/100=0.38.
I could calculate its confidence intervals this way:
> success<-38
> total<-100
> prop.test(success,total,p=0.5,alternative="two.sided")

	1-sample proportions test with continuity

data:  success out of total, null probability 0.5 
X-squared = 5.29, df = 1, p-value = 0.02145
alternative hypothesis: true p is not equal to 0.5 
95 percent confidence interval:
 0.2863947 0.4829411 
sample estimates:

So it would be var$1=0.38 , CI=0.286-0.483

Is it correct?

View this message in context: http://r.789695.n4.nabble.com/Resampling-with-replacement-on-a-binary-0-1-variable-to-get-CIs-tp4127990p4129048.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list