Hi dear all, i have a data (data.frame) which contain y and x coloumn(i.e. y x 1 0.58545723 0.15113102 2 0.02769361 -0.02172165 3 1.00927527 -1.80072610 4 0.56504053 -1.12236685 5 0.58332337 -1.24263981 6 -1.70257274 0.46238255 7 -0.88501561 0.89484429 8 1.14466282 0.34193875 9 0.58827457 0.15923694 10 -0.79532232 -1.44193770 ) i changed the first data points by an outlier (i.e. y x 1 10 25 2 0.02769361 -0.02172165 3 1.00927527 -1.80072610 4 0.56504053 -1.12236685 5 0.58332337 -1.24263981 6 -1.70257274 0.46238255 7 -0.88501561 0.89484429 8 1.14466282 0.34193875 9 0.58827457 0.15923694 10 -0.79532232 -1.44193770 ) then i generate the 1000 bootstrap sample with this data set, some of them not contain these outliers, some of them contain once and some of them contain many time... Now i want to count how many samples not contain these outliers. Thank so much any idea! -- View this message in context: http://r.789695.n4.nabble.com/Counting-tp3045756p3045756.html Sent from the R help mailing list archive at Nabble.com.
You could try something like this: Loop through your bootstrapped samples and store which ones have the outlier you are looking for using code like: count = c(count, outlier.value %in% boot.sample$outlier.variable) Then subtract the count variable from the total number of samples to get the number of samples without the outlier N.nooutlier = Total - count Andrew Miles On Nov 16, 2010, at 4:55 PM, ufuk beyaztas wrote:> > Hi dear all, > > i have a data (data.frame) which contain y and x coloumn(i.e. > > y x > 1 0.58545723 0.15113102 > 2 0.02769361 -0.02172165 > 3 1.00927527 -1.80072610 > 4 0.56504053 -1.12236685 > 5 0.58332337 -1.24263981 > 6 -1.70257274 0.46238255 > 7 -0.88501561 0.89484429 > 8 1.14466282 0.34193875 > 9 0.58827457 0.15923694 > 10 -0.79532232 -1.44193770 ) > > i changed the first data points by an outlier (i.e. > > y x > 1 10 25 > 2 0.02769361 -0.02172165 > 3 1.00927527 -1.80072610 > 4 0.56504053 -1.12236685 > 5 0.58332337 -1.24263981 > 6 -1.70257274 0.46238255 > 7 -0.88501561 0.89484429 > 8 1.14466282 0.34193875 > 9 0.58827457 0.15923694 > 10 -0.79532232 -1.44193770 ) > > then i generate the 1000 bootstrap sample with this data set, some > of them > not contain these outliers, some of them contain once and some of them > contain many time... Now i want to count how many samples not > contain these > outliers. > Thank so much any idea! > > > -- > View this message in context: http://r.789695.n4.nabble.com/Counting-tp3045756p3045756.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.
thank you very much for your idea, if i write code as; my data name is data. samples<-function(data,num){ resamples<-lapply(1:num,function(i) sample(data,n,replace=TRUE)) list(resamples=resamples)}>n=10data<-rnorm(n=10,mean=5,sd=2) data[1]=100 obj<-samples(data,1000) i generate 1000 sample, i did not use 'boot'. 100 is a outlier in the data set and same stuation, some of samples not contain , some of samples contain once and some of them contain many times. Now can you tell me how i count how many samples are there not contain any outlier in the 1000 samples? -- View this message in context: http://r.789695.n4.nabble.com/Counting-tp3045756p3045842.html Sent from the R help mailing list archive at Nabble.com.