Example #1
0
def search_all_vs_one(all_data, key, rsq_thresh=0., covariates=[], plot=False):
    """For each pair of variables, look for a significant regression slope."""

    results = []
    all_keys = list(set(all_data.keys()) - set(('SubjID', key)))
    for all_key in all_keys:
        if not is_ai_key(all_key):
            continue
        try:
            result = find_one_relationship(all_data,
                                           key,
                                           all_key,
                                           covariates=covariates,
                                           rsq_thresh=rsq_thresh,
                                           plot=plot)
        except TypeError as te:
            # Happens when the data type is string or other non-regressable.
            continue
        if result is not None:
            results.append(result)

    # Now, output the sorted result.
    for all_key, p, r in sorted(results, lambda v1, v2: int(10000 * (v1[2] - v2[2]))):
        print("Significant at %.2e (r=%.3f): %s" % (p, r, all_key))