Skip to content

Instantly share code, notes, and snippets.

@dcrosta
Created October 19, 2011 15:55
Show Gist options
  • Save dcrosta/1298732 to your computer and use it in GitHub Desktop.
Save dcrosta/1298732 to your computer and use it in GitHub Desktop.
# report will be something like:
#
# { test_name: 'signup button',
# alternatives: ['Red', 'Green'],
# results: [
# { attempted: 248,
# completed: 12
# },
# {
# attempted: 226,
# completed: 18
# }
# ]
# }
num_trials = sum(r['completed'] for r in report['results'])
avg = float(num_trials) / len(report['alternatives'])
diffs = [r['completed'] - avg for r in report['results'])
avgdiff = sum(diffs) / len(report['alternatives'])
significant = pow(avgdiff, 2) > trials
if significant:
print 'wahoo!'
else:
print ':-('
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment