[R] Counting

Andrew Miles rstuff.miles at gmail.com
Tue Nov 16 23:05:43 CET 2010


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.



More information about the R-help mailing list