Advertisement
nikson1

Untitled

Apr 2nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from collections import defaultdict
  2. from scipy.stats import ttest_ind
  3. import numpy as np
  4.  
  5. if __name__=='__main__':
  6.     response_times = defaultdict(list)
  7.     with open('log.txt', 'r') as input_file:
  8.         for line in input_file:
  9.             index, response, time = line.split(',')
  10.             response_times[response].append(float(time))
  11.  
  12.     print 'Mean response times'
  13.     for k in response_times.keys():
  14.         print(k, np.mean(response_times[k]))
  15.    
  16.     pval = ttest_ind(response_times['/index'], response_times['/test'], equal_var=False)[1]
  17.     print 'P-value =', pval
  18.     if pval > 0.05:
  19.         print 'H0 hypothesis accepted'
  20.     else:
  21.         print 'H0 hypothesis rejected'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement