Source From Here
QuestionSo I have lists of floats. Like [1.33,2.555,3.2134,4.123123] etc. Those lists are mean frequencies of something. How do I proof that two lists are different? I thought about calculating p-value. Is there a function to do that? I looked through scipy documentation, but couldn't figure out what to use.
HowTo
Let's say you have a list of floats like this:
- data = {'a': [0.9, 1.0, 1.1, 1.2],'b': [0.8, 0.9, 1.0, 1.1],'c': [4.9, 5.0, 5.1, 5.2],}
The former can be achieved using independent t-tests as follows:
This provides the relevant p-values, and implies that that a and c are different, b and c are different, but a and b may be similar. (Check "What a p-value tells you about statistical significance". A p-value less than 0.05 is statistically significant in difference.)
The latter can be achieved using the one-way ANOVA as follows:
- >>> from scipy.stats import f_oneway
- >>> t, p = f_oneway(*data.values())
- >>> p
- 7.959305946160327e-12
沒有留言:
張貼留言