Guest User

Untitled

a guest
Mar 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import numpy as np
  2. import scipy as sp
  3. import scipy.stats
  4.  
  5. def mean_confidence_interval(data, confidence=0.95):
  6. a = 1.0*np.array(data)
  7. n = len(a)
  8. m, se = np.mean(a), scipy.stats.sem(a)
  9. h = se * sp.stats.t._ppf((1+confidence)/2., n-1)
  10. # return m, m-h, m+h, h
  11. return m, h
  12.  
  13. iostimeline, h = np.apply_along_axis(mean_confidence_interval, 0, ioshourmatrix)
  14. androidtimeline, h = np.apply_along_axis(mean_confidence_interval, 0, androidhourmatrix)
  15.  
  16. # plt.plot(iostimeline, 'b-', label='iOS')
  17. # plt.plot(androidtimeline, 'g-', label='Android')
  18.  
  19. line, caps, bars = plt.errorbar(list(range(24)), iostimeline, yerr=h)
  20. plt.setp(line, label="iOS") # give label to returned line
  21. line, caps, bars = plt.errorbar(list(range(24)), androidtimeline, yerr=h)
  22. plt.setp(line, label="Android") # give label to returned line
  23.  
  24. plt.legend(loc=0)
Add Comment
Please, Sign In to add comment