Пример #1
0
def main():
    # test the distribution of birth weights for normality
    live_births, _, _ = cumulative.MakeTables()
    
    t = GetWeights(live_births)

    MakeNormalPlot(t)
Пример #2
0
def main():
    random.seed(time.clock())
    pool, firsts, others = cumulative.MakeTables()
    mean_var = thinkstats.MeanVar(pool.lengths)
    print('(Mean, Var) of pooled data', mean_var)

    print("--------------4/4 ")

    # NSFG原始数据
    hypothesis.RunTest('length-4-4', 
            pool.lengths,
            firsts.lengths, 
            others.lengths, 
            iters=1000,
            trim=False,
            partition=False)

    print("--------------3/4 ")

    # NSFG数据 3/4
    hypothesis.RunTest('length-3-4', 
            hypothesis.SampleWithoutReplacement(pool.lengths, int(pool.n * 0.75)),
            hypothesis.SampleWithoutReplacement(firsts.lengths, int(firsts.n * 0.75)),
            hypothesis.SampleWithoutReplacement(others.lengths, int(others.n * 0.75)),
            iters=1000,
            trim=False,
            partition=False)

    print("--------------2/4 ")

    # NSFG数据 1/2
    hypothesis.RunTest('length-half-2-4', 
            hypothesis.SampleWithoutReplacement(pool.lengths, int(pool.n * 0.5)),
            hypothesis.SampleWithoutReplacement(firsts.lengths, int(firsts.n * 0.5)),
            hypothesis.SampleWithoutReplacement(others.lengths, int(others.n * 0.5)),
            iters=1000,
            trim=False,
            partition=False)

    print("--------------1/4 ")

    # NSFG数据 1/4
    hypothesis.RunTest('length-half-1-4', 
            hypothesis.SampleWithoutReplacement(pool.lengths, int(pool.n * 0.25)),
            hypothesis.SampleWithoutReplacement(firsts.lengths, int(firsts.n * 0.25)),
            hypothesis.SampleWithoutReplacement(others.lengths, int(others.n * 0.25)),
            iters=1000,
            trim=False,
            partition=False)
Пример #3
0
def main():
    random.seed(17)

    # make the continuous CDFs
    MakeExpoCdf()
    MakeParetoCdf()
    MakeParetoCdf2()
    MakeNormalCdf()

    # test the distribution of birth weights for normality
    pool, _, _ = cumulative.MakeTables()

    t = pool.weights
    MakeNormalModel(t)
    MakeNormalPlot(t)
Пример #4
0
def main():
    random.seed(1)

    # get the data
    pool, firsts, others = cumulative.MakeTables()
    mean_var = thinkstats.MeanVar(pool.lengths)
    print('(Mean, Var) of pooled data', mean_var)

    # run the test
    RunTest('length',
            pool.lengths,
            firsts.lengths,
            others.lengths,
            iters=1000,
            trim=False,
            partition=False)
Пример #5
0
def main():
    # get the data
    pool, firsts, others = cumulative.MakeTables()

    # run the test
    Test(firsts.lengths, others.lengths, pool.lengths, iters=1000)