示例#1
0
文件: regress.py 项目: lcurley/PING
def search_all_pairwise(all_data):
    """For each pair of variables, look for a significant regression slope."""
    results = []
    keys = list(set(all_data.keys()) - set(('SubjID',)))
    for ki in range(len(keys)):
        key1 = keys[ki]
        if skip_key(key1):
            continue

        for ii in range(ki + 1, len(keys)):
            key2 = keys[ii]
            if skip_key(key2) or skip_pairing(key1, key2):
                continue
            
            result = find_one_relationship(all_data, key1, key2, rsq_thresh=0.10)
            if result is not None:
                results.append(result)

    # Now, output the sorted result.
    for key, p, r in sorted(results, lambda v1, v2: int(10000 * (abs(v1[2]) - abs(v2[2])))):
        print("Significant at %.2e (r=%.3f): %s" % (p, r, key))
示例#2
0
文件: regress.py 项目: lcurley/PING
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))