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

David Winsemius dwinsemius at comcast.net
Thu Dec 1 17:38:30 CET 2011


On Dec 1, 2011, at 10:49 AM, lincoln wrote:

> Thanks.
>
> 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
> 	correction
>
> 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:
>   p
> 0.38
>
> So it would be var$1=0.38 , CI=0.286-0.483
>
> Is it correct?
>

I couldn't tell if this were homework, so I just threw out a starting  
point. If you were told to do a resampling method then this would just  
be a starting point and you would be expected to go further with the  
boot function.

> --
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list