Hello - I have a population of 100 individuals that I would like to bootstrap 10 times, every time removing 5 *different* individuals. So far, I have done the following: pop <- read.table('mypop.txt', header=FALSE) replicate(10, sample(pop, 95, replace=FALSE)) I have not actually gone through each of the 10 files created to make sure no single individual was removed more than once during the 10 bootstraps. But will the above syntax achieve this object? Thanks V
No, it will not, except possibly by chance: if the draws of sample are IID (and they are supposed to be) there's no reason to expect them not to overlap. If you want that -- and I'm not sure it's totally on the level bootstrapping-wise -- you need to decide which ones to remove all in one fell swoop: Something like this: ToDrop <- matrix(sample(100, 50, replace = FALSE), ncol = 10) apply(ToDrop, 2, function(x) pop[-x]) Michael On Thu, May 10, 2012 at 7:56 PM, Vikram Chhatre <crypticlineage at gmail.com> wrote:> Hello - > > I have a population of 100 individuals that I would like to bootstrap > 10 times, every time removing 5 *different* individuals. > > So far, I have done the following: > > pop <- read.table('mypop.txt', header=FALSE) > > replicate(10, sample(pop, 95, replace=FALSE)) > > I have not actually gone through each of the 10 files created to make > sure no single individual was removed more than once during the 10 > bootstraps. ?But will the above syntax achieve this object? > > Thanks > V > > ______________________________________________ > 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.
> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Vikram Chhatre > Sent: Thursday, May 10, 2012 4:57 PM > To: r-help at r-project.org > Subject: [R] Resampling question > > Hello - > > I have a population of 100 individuals that I would like to bootstrap > 10 times, every time removing 5 *different* individuals. > > So far, I have done the following: > > pop <- read.table('mypop.txt', header=FALSE) > > replicate(10, sample(pop, 95, replace=FALSE)) > > I have not actually gone through each of the 10 files created to make > sure no single individual was removed more than once during the 10 > bootstraps. But will the above syntax achieve this object? > > Thanks > VWhat you are doing is probably more appropriately called a jack-knife, rather than bootstrap. Be that as it may, your approach will not prevent someone being dropped more than once. You might randomly select 50 people without replacement and then drop them 5 at a time from the original population to_drop <- sample(100,50,replace=FALSE) rep1 <- pop[-to_drop[1:5],] rep2 <- pop[-to_drop[6:10],] ... I will let you decide how you want automate this. Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204