def is_higher_order(e1, e0): """ Returns True if e1 is a higher order term of e0 (i.e., all factors in e0 are contained in e1). e1, e0 : effects The effects to compare. """ f1s = find_factors(e1) return all(f in f1s for f in find_factors(e0))
def _hopkins_test(e, e2): """ Tests whether e2 is in the E(MS) of e. e : effect effect whose E(MS) is being constructed e2 : effect model effect which is tested for inclusion in E(MS) of e """ if e is e2: return False else: e_factors = find_factors(e) e2_factors = find_factors(e2) a = np.all([(f in e_factors or f.random) for f in e2_factors]) b = np.all([(f in e2_factors or isnestedin(e2, f)) for f in e_factors]) return a and b