In [1]:
%pylab inline
In [5]:
windows = [625, 480, 621, 633]
mac = [647, 503, 559, 586]
Now Lets try to calculate the mean ... you can just use mean()
In [ ]:
we can also plot the raw data
In [ ]:
figure()
plot(windows)
plot(mac,'r')
apply a t-test to check for significance
In [53]:
from scipy.stats import ttest_ind
from scipy.stats import ttest_rel
import scipy.stats as stats
#onesided t-test
ttest_ind(mac,windows)
#two sided t-test
Out[53]:
In [54]:
ttest_rel(mac,windows)
Out[54]:
let's say we get more data
In [41]:
more_win = [625, 480, 621, 633,694,599,505,527,651,505]
more_mac = [647, 503, 559, 586, 458, 380, 477, 409, 589,472]
what to do if we have more than 3 use an ANOVA in python stats.f_oneway()
In [51]:
more_bottom = [485,436, 512, 564, 560, 587, 391, 488, 555, 446]
Out[51]:
Let's take a look at some other data set (and actually import data from a file).
In [25]:
import pandas as pd
aq=pd.read_csv('data/anscombesQuartet.csv')
In [28]:
aq
Out[28]:
In [29]:
mean(aq['I_y'])
Out[29]:
again ... caluclate the means for all x.
calcuate the variance for x
variance for y
In [36]:
Out[36]:
In [35]:
In [38]:
Out[38]:
In [46]:
In [ ]: