Exemplo n.º 1
0
 def table(self, title=None, caption=None):
     """Table with effects and smallest p-value"""
     if self.test_type is LMGroup:
         cols = sorted(
             {col
              for res in self.values() for col in res.column_names})
         table = fmtxt.Table('l' * (1 + len(cols)),
                             title=title,
                             caption=caption)
         table.cell('')
         table.cells(*cols)
         table.midrule()
         for key, lmg in self.items():
             table.cell(key)
             for res in (lmg.tests[c] for c in cols):
                 pmin = res.p.min()
                 table.cell(fmtxt.FMText([fmtxt.p(pmin), star(pmin)]))
     elif self.test_type is anova:
         table = fmtxt.Table('lllll', title=title, caption=caption)
         table.cells('Test', 'Effect',
                     fmtxt.symbol(self.test_type._statistic, 'max'),
                     fmtxt.symbol('p'), 'sig')
         table.midrule()
         for key, res in self.items():
             for i, effect in enumerate(res.effects):
                 table.cells(key, effect)
                 pmin = res.p[i].min()
                 table.cell(fmtxt.stat(res._max_statistic(i)))
                 table.cell(fmtxt.p(pmin))
                 table.cell(star(pmin))
                 key = ''
     else:
         table = fmtxt.Table('llll', title=title, caption=caption)
         table.cells('Effect',
                     fmtxt.symbol(self.test_type._statistic, 'max'),
                     fmtxt.symbol('p'), 'sig')
         table.midrule()
         for key, res in self.items():
             table.cell(key)
             pmin = res.p.min()
             table.cell(fmtxt.stat(res._max_statistic()))
             table.cell(fmtxt.p(pmin))
             table.cell(star(pmin))
     return table
Exemplo n.º 2
0
def test_star():
    "Test the star function"
    assert_array_equal(_test.star([0.1, 0.04, 0.01], int, corr=None), [0, 1, 2])
    assert_array_equal(_test.star([0.1, 0.04, 0.01], int), [0, 0, 1])
Exemplo n.º 3
0
def test_star():
    "Test the star function"
    assert_array_equal(_test.star([0.1, 0.04, 0.01], int), [0, 1, 2])
    assert_array_equal(_test.star([0.001, 0.04, 0.1], int), [3, 1, 0])
Exemplo n.º 4
0
def test_star():
    "Test the star function"
    assert_array_equal(_test.star([0.1, 0.04, 0.01], int), [0, 1, 2])
    assert_array_equal(_test.star([0.001, 0.04, 0.1], int), [3, 1, 0])