[R] Depletion of small p values upon iterative testing of identical normal distributions

Ben Bolker bbolker at gmail.com
Mon Sep 20 16:35:52 CEST 2010


A <petlyakov <at> gmail.com> writes:

> 
> Dear all,

 [snip]

> Here are two key parts of my code to show what functions I'm working with:
> 
> #Calculating the p values
> while(i<numtests){
> Group1<-rnorm(6,-0.0065,0.0837)
> Group2<-rnorm(6,-0.0065,0.0837)
> PV<-t.test(Group1,Group2)$p.value
> pscoresvector<-c(PV,pscoresvector)
> i<-i+1
> }
> 
> #Binning the results
> freqtbl1<-binning(pscoresvector,breaks=bins)

Also consider

> f <- function() {
+   Group1 <- rnorm(6,-0.0065,0.0837)
+   Group2 <- rnorm(6,-0.0065,0.0837)
+   t.test(Group1,Group2)$p.value
+ }
> pscoresvector <- replicate(10000,f())
> table(cut(pscoresvector,breaks=...))

  Is your lowest bin perhaps narrower than your other bins
(although admittedly I can't see an easy reason it should be
only 5% smaller -- 50% would be a more typical result of a binning
mistake)?



More information about the R-help mailing list