Esempio n. 1
0
 def test_axis_None(self):
     # Test axis=None (equal to axis=0 for 1-D input)
     x = np.array((-2,-1,0,1,2,3)*4)**2
     assert_allclose(mstats.normaltest(x, axis=None), mstats.normaltest(x))
     assert_allclose(mstats.skewtest(x, axis=None), mstats.skewtest(x))
     assert_allclose(mstats.kurtosistest(x, axis=None),
                     mstats.kurtosistest(x))
Esempio n. 2
0
 def test_axis_None(self):
     # Test axis=None (equal to axis=0 for 1-D input)
     x = np.array((-2,-1,0,1,2,3)*4)**2
     assert_allclose(mstats.normaltest(x, axis=None), mstats.normaltest(x))
     assert_allclose(mstats.skewtest(x, axis=None), mstats.skewtest(x))
     assert_allclose(mstats.kurtosistest(x, axis=None),
                     mstats.kurtosistest(x))
Esempio n. 3
0
 def test_maskedarray_input(self):
     # Add some masked values, test result doesn't change
     x = np.array((-2, -1, 0, 1, 2, 3) * 4) ** 2
     xm = np.ma.array(np.r_[np.inf, x, 10], mask=np.r_[True, [False] * x.size, True])
     assert_allclose(mstats.normaltest(xm), stats.normaltest(x))
     assert_allclose(mstats.skewtest(xm), stats.skewtest(x))
     assert_allclose(mstats.kurtosistest(xm), stats.kurtosistest(x))
Esempio n. 4
0
 def test_maskedarray_input(self):
     # Add some masked values, test result doesn't change
     x = np.array((-2,-1,0,1,2,3)*4)**2
     xm = np.ma.array(np.r_[np.inf, x, 10],
                      mask=np.r_[True, [False] * x.size, True])
     assert_allclose(mstats.normaltest(xm), stats.normaltest(x))
     assert_allclose(mstats.skewtest(xm), stats.skewtest(x))
     assert_allclose(mstats.kurtosistest(xm), stats.kurtosistest(x))
Esempio n. 5
0
    def test_vs_nonmasked(self):
        x = np.array((-2, -1, 0, 1, 2, 3) * 4) ** 2
        assert_array_almost_equal(mstats.normaltest(x), stats.normaltest(x))
        assert_array_almost_equal(mstats.skewtest(x), stats.skewtest(x))
        assert_array_almost_equal(mstats.kurtosistest(x), stats.kurtosistest(x))

        funcs = [stats.normaltest, stats.skewtest, stats.kurtosistest]
        mfuncs = [mstats.normaltest, mstats.skewtest, mstats.kurtosistest]
        x = [1, 2, 3, 4]
        for func, mfunc in zip(funcs, mfuncs):
            assert_raises(ValueError, func, x)
            assert_raises(ValueError, mfunc, x)
Esempio n. 6
0
    def test_vs_nonmasked(self):
        x = np.array((-2,-1,0,1,2,3)*4)**2
        assert_array_almost_equal(mstats.normaltest(x), stats.normaltest(x))
        assert_array_almost_equal(mstats.skewtest(x), stats.skewtest(x))
        assert_array_almost_equal(mstats.kurtosistest(x),
                                  stats.kurtosistest(x))

        funcs = [stats.normaltest, stats.skewtest, stats.kurtosistest]
        mfuncs = [mstats.normaltest, mstats.skewtest, mstats.kurtosistest]
        x = [1, 2, 3, 4]
        for func, mfunc in zip(funcs, mfuncs):
            assert_raises(ValueError, func, x)
            assert_raises(ValueError, mfunc, x)
Esempio n. 7
0
 def test_skewtest_result_attributes(self):
     x = np.array((-2, -1, 0, 1, 2, 3)*4)**2
     res = mstats.skewtest(x)
     attributes = ('statistic', 'pvalue')
     check_named_results(res, attributes, ma=True)
Esempio n. 8
0
 def test_skewtest_result_attributes(self):
     x = np.array((-2, -1, 0, 1, 2, 3) * 4)**2
     res = mstats.skewtest(x)
     attributes = ('statistic', 'pvalue')
     check_named_results(res, attributes, ma=True)
plt.setp(r2['boxes'], color='black',lw=1.5) 
plt.setp(r2['whiskers'], color='black',lw=1.5) 
plt.setp(r2['caps'], color='black',lw=1.5)
plt.setp(r2['medians'], color='black',lw=1.5)
 
ax.set_ylabel('TOTAL EDDY AREA, IN METERS SQUARED')
ax.get_yaxis().set_major_formatter(tkr.FuncFormatter(lambda x, p: format(int(x), ',')))
plt.tight_layout()
plt.savefig(r"C:\workspace\Time_Series\Output\Joes_Figs\grouped_mc_area_boxplot.png",dpi=600)

from scipy.stats.mstats import normaltest, skewtest

print 'old ', normaltest(area_old)
print 'combined ', normaltest(combined)

print 'old ', skewtest(area_old)
print 'combined ', skewtest(combined)

a = probplot(area_old,dist='norm', plot=None)
b= probplot(combined,dist='norm', plot=None)
colors = {'r':'red','s':'blue', 'u':'green'}
markers = {'r':'*','s':'x', 'u':'o'}

old_df = pd.DataFrame(area_old, columns=['Long Term Sites: N=12'])
old_df['Bar_Type'] = lt_bt
old_df = old_df.sort_values(by='Long Term Sites: N=12')
old_df['quart']=a[0][0]

combined_df = pd.DataFrame(combined, columns=['ALL SITES N=22'])
combined_df['Bar_Type'] = lt_bt + new_bt
combined_df = combined_df.sort_values(by='ALL SITES N=22')
Esempio n. 10
0
args = parser.parse_args()

times = []
files = glob.glob("{0}/*.csv".format(args.dir))

for phile in files:
	with open(phile, 'rb') as csvfile:
	    reader = csv.reader(csvfile, delimiter=',')
	    for row in reader:
	    	if(len(row)>12):
	    		nums = map(lambda x: int(x), row[12].split(":"))
	    		seconds = nums[0] * 3600 + nums[1] * 60 + nums[2]
	    		times.append(seconds)

print(normaltest(times))
print(mstats.skewtest(times))
print(stats.describe(times))

n, (smin, smax), sm, sv, ss, sk = stats.describe(times)
num_bins = 50

# the histogram of the data
n, bins, patches = plt.hist(times, num_bins, normed=1, facecolor='blue', alpha=0.5)

# add a 'best fit' line
y = mlab.normpdf(bins, sm, math.sqrt(sv))
plt.plot(bins, y, 'r--')
plt.xlabel('Time')
plt.ylabel('')
plt.title(r'2014 NYC Marathon Times')