lincoln
2011-Dec-01 11:34 UTC
[R] Resampling with replacement on a binary (0, 1) dataset to get Cis
...is it possible to do that? I apologize for something that must be a very trivial question for most of you but, unfortunately, it is not for me. A binary variable is measured, say, 50 times each year during 10 year. My interest is focused on the percentage of 1s with respect to the total if each year. There is no way to repeat those measure within each year and getting the CIs by the "normal way". By the way, it would be important to get even a rough estimate of the CIs of these estimates (/n/1//n/1+/n/0). In case this is not a blasphemy, how might be done in R? Thanks in advance for any help -- View this message in context: http://r.789695.n4.nabble.com/Resampling-with-replacement-on-a-binary-0-1-dataset-to-get-Cis-tp4127990p4127990.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2011-Dec-01 13:34 UTC
[R] Resampling with replacement on a binary (0, 1) dataset to get Cis
On Dec 1, 2011, at 6:34 AM, lincoln wrote:> ...is it possible to do that? > > I apologize for something that must be a very trivial question for > most of > you but, unfortunately, it is not for me. > A binary variable is measured, say, 50 times each year during 10 > year. My > interest is focused on the percentage of 1s with respect to the > total if > each year. > There is no way to repeat those measure within each year and getting > the CIs > by the "normal way". > By the way, it would be important to get even a rough estimate of > the CIs of > these estimates (/n/1//n/1+/n/0). > > In case this is not a blasphemy, how might be done in R??prop.test> > Thanks in advance for any help >David Winsemius, MD West Hartford, CT
lincoln
2011-Dec-01 15:49 UTC
[R] Resampling with replacement on a binary (0, 1) dataset to get Cis
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? -- 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.