Exemplo n.º 1
0
    chiSquareResults = []
    chiSquareYatesResults = []
    gTestResults = []
    gTestYatesResults = []
    permutationResults = []
    diffBetweenPropResults = []
    bootstrapResults = []
    for a in xrange(0, maxPositiveSeqs + 1):
        for b in xrange(a, maxPositiveSeqs + 1):
            # calculate p-values
            barnardOneSided, barnardTwoSided = barnard.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            if (barnardTwoSided < 0.01 or barnardTwoSided > 0.1):
                continue

            fishersOneSided, fishersTwoSided = fishers.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            chiSquareOneSided, chiSquareTwoSided = chiSquare.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            chiSquareYatesOneSided, chiSquareYatesTwoSided = chiSquareYates.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            gTestOneSided, gTestTwoSided = gTest.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            gTestYatesOneSided, gTestYatesTwoSided = gTestYates.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            diffBetweenPropOneSided, diffBetweenPropTwoSided = diffBetweenProp.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            permutationOneSided, permutationTwoSided = permutation.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
            bootstrapOneSided, bootstrapTwoSided = bootstrap.hypothesisTest(
                a, b, totalSamples1, totalSamples2)
Exemplo n.º 2
0
       samplesNotInSS -= 1          
     
   # draw samples w/o replacement for community 2
   samplesInSS = popSize*prop
   samplesNotInSS = popSize - samplesInSS      
   inSS2 = 0
   for s in xrange(0, sampleSize2[sampleSizeIndex]):
     rnd = random.random()
     
     if rnd <= float(samplesInSS) / popSize:
       samplesInSS -= 1
       inSS2 += 1
     else:
       samplesNotInSS -= 1
                 
   fishersOneSided, fishersTwoSided = fishers.hypothesisTest(inSS1, inSS2, totalSamples1, totalSamples2)        
   gTestOneSided, gTestTwoSided = gTest.hypothesisTest(inSS1, inSS2, totalSamples1, totalSamples2)
   gTestYatesOneSided, gTestYatesTwoSided = gTestYates.hypothesisTest(inSS1, inSS2, totalSamples1, totalSamples2)
   diffBetweenPropOneSided, diffBetweenPropTwoSided = diffBetweenProp.hypothesisTest(inSS1, inSS2, totalSamples1, totalSamples2)
   
   fishersResults.append(fishersTwoSided)
   gTestResults.append(gTestTwoSided)
   gTestYatesResults.append(gTestYatesTwoSided)
   diffBetweenPropResults.append(diffBetweenPropTwoSided)   
   
 pValues = [fishersResults,gTestResults,gTestYatesResults,diffBetweenPropResults] 
   
 bins = {}
 numBins = 20
 binSize = 1.0 / numBins
 for i in xrange(0,numBins):
Exemplo n.º 3
0
    maxPositiveSeqs = 200

fishersResults = []
chiSquareResults = []
chiSquareYatesResults = []
gTestResults = []
gTestYatesResults = []
permutationResults = []
diffBetweenPropResults = []
bootstrapResults = []
for a in xrange(11, maxPositiveSeqs):
    print a
    for b in xrange(a, maxPositiveSeqs):

        # calculate p-values
        fishersOneSided, fishersTwoSided = fishers.hypothesisTest(a, b, totalSamples1, totalSamples2)
        chiSquareOneSided, chiSquareTwoSided = chiSquare.hypothesisTest(a, b, totalSamples1, totalSamples2)
        chiSquareYatesOneSided, chiSquareYatesTwoSided = chiSquareYates.hypothesisTest(
            a, b, totalSamples1, totalSamples2
        )
        gTestOneSided, gTestTwoSided = gTest.hypothesisTest(a, b, totalSamples1, totalSamples2)
        gTestYatesOneSided, gTestYatesTwoSided = gTestYates.hypothesisTest(a, b, totalSamples1, totalSamples2)
        diffBetweenPropOneSided, diffBetweenPropTwoSided = diffBetweenProp.hypothesisTest(
            a, b, totalSamples1, totalSamples2
        )
        permutationOneSided, permutationTwoSided = permutation.hypothesisTest(a, b, totalSamples1, totalSamples2)
        bootstrapOneSided, bootstrapTwoSided = bootstrap.hypothesisTest(a, b, totalSamples1, totalSamples2)

        fishersResults.append(fishersTwoSided)
        chiSquareResults.append(chiSquareTwoSided)
        chiSquareYatesResults.append(chiSquareYatesTwoSided)
Exemplo n.º 4
0
                    samplesNotInSS -= 1

            # draw samples w/o replacement for community 2
            samplesInSS = popSize * prop
            samplesNotInSS = popSize - samplesInSS
            inSS2 = 0
            for s in xrange(0, sampleSize2[sampleSizeIndex]):
                rnd = random.random()

                if rnd <= float(samplesInSS) / popSize:
                    samplesInSS -= 1
                    inSS2 += 1
                else:
                    samplesNotInSS -= 1

            fishersOneSided, fishersTwoSided = fishers.hypothesisTest(
                inSS1, inSS2, totalSamples1, totalSamples2)
            gTestOneSided, gTestTwoSided = gTest.hypothesisTest(
                inSS1, inSS2, totalSamples1, totalSamples2)
            gTestYatesOneSided, gTestYatesTwoSided = gTestYates.hypothesisTest(
                inSS1, inSS2, totalSamples1, totalSamples2)
            diffBetweenPropOneSided, diffBetweenPropTwoSided = diffBetweenProp.hypothesisTest(
                inSS1, inSS2, totalSamples1, totalSamples2)

            fishersResults.append(fishersTwoSided)
            gTestResults.append(gTestTwoSided)
            gTestYatesResults.append(gTestYatesTwoSided)
            diffBetweenPropResults.append(diffBetweenPropTwoSided)

        pValues = [
            fishersResults, gTestResults, gTestYatesResults,
            diffBetweenPropResults