コード例 #1
0
def comparing_stat_patch_list(pred, y):
    patch1 = mpatches.Patch(color='red',
                            label='mean:' + ('%03.6f' % np.mean(pred)))
    patch2 = mpatches.Patch(color='red',
                            label='std:' + ('%03.6f' % np.std(pred)))
    patch3 = mpatches.Patch(color='red',
                            label='skewness:' +
                            ('%03.3f' % stats.skewness(pred)))
    patch4 = mpatches.Patch(color='red',
                            label='kurtosis:' +
                            ('%03.3f' % stats.kurtosis(pred)))
    patch5 = mpatches.Patch(color='blue',
                            label='mean:' + ('%03.6f' % np.mean(y)))
    patch6 = mpatches.Patch(color='blue',
                            label='std:' + ('%03.6f' % np.std(y)))
    patch7 = mpatches.Patch(color='blue',
                            label='skewness:' + ('%03.3f' % stats.skewness(y)))
    patch8 = mpatches.Patch(color='blue',
                            label='kurtosis:' + ('%03.3f' % stats.kurtosis(y)))
    #patch9 = mpatches.Patch(color='black', label= 'MAPE:'+ ('%03.3f' % stats.mape(pred, y)))
    patch10 = mpatches.Patch(color='black',
                             label='RMSE:' + ('%03.6f' % stats.rmse(pred, y)))
    #plt.text(.25,.5,str(np.mean(pred)))
    return [
        patch5, patch6, patch7, patch8, patch1, patch2, patch3, patch4, patch10
    ]
コード例 #2
0
def get_seq_feature(seq, seq_name, user_id):
    # total 11 features
    if not seq:
        print('seq is empty!')
        return
    df = pd.DataFrame()
    df[seq_name + '_mean'] = [np.mean(seq)]
    df[seq_name + '_median'] = [np.median(seq)]
    df[seq_name + '_max'] = [np.max(seq)]
    df[seq_name + '_min'] = [np.min(seq)]
    df[seq_name + '_var'] = [np.var(seq)]
    df[seq_name + '_std'] = [np.std(seq)]
    if len(seq) == 1:
        df[seq_name + '_upquantile'] = seq[0]
        df[seq_name + '_downquantile'] = 0
    else:
        df[seq_name + '_upquantile'] = [sts.quantile(seq, p=0.75)]
        df[seq_name + '_downquantile'] = [sts.quantile(seq, p=0.25)]
    if np.mean(seq) != 0: df[seq_name + '_discrete'] = [np.std(seq) / np.mean(seq)]
    else: df[seq_name + '_discrete'] = [np.NaN]
    try: df[seq_name + 'skew'] = [sts.skewness(seq)]
    except: df[seq_name + 'skew'] = [np.NaN]
    try: df[seq_name + 'kurt'] = [sts.kurtosis(seq)]
    except: df[seq_name + 'kurt'] = [np.NaN]
    df['user_id'] = [user_id]
    return df
コード例 #3
0
ファイル: dwt_stock.py プロジェクト: tanshinepan/vnpy_future
def kusk(t_win, stockdata, indexes):
    '''

    :param t_win: 窗口长度
    :param stockdata: 股票序列
    :param indexes: 遍历下标
    :return: 滑动窗口得到股票序列的峰度、偏度、波动率、收益率指标
    '''
    sk = []
    ku = []
    std = []
    res = []
    for j in indexes:
        s = stockdata.iloc[-j - 2 * t_win:-j - t_win]
        print("s_length: ", len(s))
        sk.append(sts.skewness(s))
        ku.append(sts.kurtosis(s))
        std.append(np.std(s))
        res.append((s.iloc[-1] - s.iloc[0]) / s.iloc[0])

    df = pd.DataFrame({
        "时间": pd.Series(s.date),
        "峰度": pd.Series(sk),
        "偏度": pd.Series(ku),
        "波动率": pd.Series(std),
        "收益率": pd.Series(res)
    })
    return df
コード例 #4
0
def stat_patch_list(x):
    patch0 = mpatches.Patch(label='data num:' + str((x.size)))
    patch1 = mpatches.Patch(label='mean:' + ('%03.6f' % np.mean(x)))
    patch2 = mpatches.Patch(label='std:' + ('%03.6f' % np.std(x)))
    patch3 = mpatches.Patch(label='skewness:' + ('%03.3f' % stats.skewness(x)))
    patch4 = mpatches.Patch(label='kurtosis:' + ('%03.3f' % stats.kurtosis(x)))
    return [patch0, patch1, patch2, patch3, patch4]
コード例 #5
0
def data_description(index, start, end):
    returns = download_data.get_returns(index, start, end)
    print('个数:', len(returns))
    print('平均值:', np.mean(returns))
    print('中位数:', np.median(returns))
    print('上四分位数', sts.quantile(returns, p=0.25))
    print('下四分位数', sts.quantile(returns, p=0.75))
    #离散趋势的度量
    print('最大值:', np.max(returns))
    print('最小值:', np.min(returns))
    print('极差:', np.max(returns) - np.min(returns))
    print('四分位差',
          sts.quantile(returns, p=0.75) - sts.quantile(returns, p=0.25))
    print('标准差:', np.std(returns))
    print('方差:', np.var(returns))
    print('离散系数:', np.std(returns) / np.mean(returns))
    #偏度与峰度的度量
    print('偏度:', sts.skewness(returns))
    print('峰度:', sts.kurtosis(returns))
    print(st.kstest(returns, 'norm'))
    length = len(returns)
    sns.distplot(returns, bins=100, label='Empirical')
    sns.plt.legend()
    sns.plt.title('Empirical')
    sns.plt.show()
コード例 #6
0
def get_seq_feature(seq, seq_name, user_id):
    if not seq:
        print('seq is empty! : %s'%seq_name)
        return
    df = pd.DataFrame()
    df[seq_name + '_mean'] = [np.mean(seq)]
    df[seq_name + '_median'] = [np.median(seq)]
    df[seq_name + '_max'] = [np.max(seq)]
    df[seq_name + '_min'] = [np.min(seq)]
    df[seq_name + '_var'] = [np.var(seq)]
    df[seq_name + '_std'] = [np.std(seq)]
    if np.mean(seq) != 0:
        df[seq_name + '_discrete'] = [np.std(seq) / np.mean(seq)]
    else:
        df[seq_name + '_discrete'] = [np.NaN]
    try:
        df[seq_name + '_skew'] = [sts.skewness(seq)]
    except:
        df[seq_name + '_skew'] = [np.NaN]
    try:
        df[seq_name + '_kurt'] = [sts.kurtosis(seq)]
    except:
        df[seq_name + '_kurt'] = [np.NaN]
    df['user_id'] = [user_id]
    return df
コード例 #7
0
def extend_feature(scores):
    """
    特征构造

    Args:
        scores: 原始滑动窗口获得的特征
    Returns:
        返回基于滑动窗口特征增加的统计特征
    """
    features = scores
    features.append(np.sum(scores))  #总数
    features.append(np.mean(scores))  #平均数
    features.append(np.median(scores))  #中位数
    # features.append(sts.mode(scores)) #众数
    features.append(sts.quantile(scores, p=0.25))  #上四分位
    features.append(sts.quantile(scores, p=0.75))  #上七分位
    features.append(np.max(scores))  #最大值
    features.append(np.min(scores))  #最小值
    features.append(np.max(scores) - np.min(scores))  #极差
    features.append(
        sts.quantile(scores, p=0.75) - sts.quantile(scores, p=0.25))  #四分位差
    features.append(np.var(scores))  #方差
    features.append(np.std(scores) / np.mean(scores))  #离散系数
    features.append(sts.skewness(scores))  #偏度
    features.append(sts.kurtosis(scores))  #峰度
    return features
コード例 #8
0
def waveCoeffs(data, wave='db4', levels=5):
    w = pywt.wavedec(data, wavelet=wave, level=levels)
    res_RSE = list()
    res_kurtosis = list()
    res_std = list()
    for i in range(1, len(w)):
        temp = 0
        for j in range(0, len(w[i])):
            temp += w[i][j]**2
        res_RSE.append(np.sqrt(temp))
        res_kurtosis.append(stats.kurtosis(w[i]))
        res_std.append(np.std(w[i]))
    return res_RSE, res_kurtosis, res_std
def waveCoeffs(data,wave='db4',levels=5):
    w = pywt.wavedec(data,wavelet=wave,level=levels)
    res_RSE = list()
    res_kurtosis = list()
    res_std = list()
    for i in range(1,len(w)):
        temp = 0
        for j in range(0,len(w[i])):
            temp += w[i][j]**2
        res_RSE.append(np.sqrt(temp))    
        res_kurtosis.append(stats.kurtosis(w[i]))
        res_std.append(np.std(w[i]))
    return res_RSE, res_kurtosis, res_std
コード例 #10
0
 def calculate_stats_num(self, name, per = [5,25,50,75,95]):
     # get columnt instance
     Col = self.get_column(name)
     # type validation
     assert Col.type == 'numerical', 'only possible numerical columns.'
     # get data
     data = self.get_data(name)
     # initialize
     dstats = dict()
     # calculate statistics
     dstats['mean'] = stats.mean(data)
     dstats['median'] = stats.median(data)
     dstats['std'] = stats.std(data)
     dstats['min'] = stats.min(data)
     dstats['max'] = stats.max(data)
     dstats['skew'] = stats.skew(data)
     dstats['kurtosis'] = stats.kurtosis(data)
     for ip in per:
         dstats['per%s'%ip] = stats.percentile(data, ip)
     # return
     Col.stats = dstats
コード例 #11
0
import pandas as pd
import numpy as np
import stats as sts

#建立一個15*5的二維陣列
post = np.zeros((15, 5))
#post
for i in range(15):
    path = 'data/post/' + str(i + 1) + '.csv'
    #將V前1萬5千筆讀出來並分析,skiprows為跳過第一個row
    V = pd.read_csv(path, skiprows=1)['V'][0:20004]
    post[i, 0] = np.std(V) / np.mean(V)  #離散係數
    post[i, 1] = np.max(V) - np.min(V)  #極差
    post[i, 2] = sts.skewness(V)  #偏度
    post[i, 3] = sts.kurtosis(V)  #峰度
    #post 為1
    post[i, 4] = '1'

pre = np.zeros((15, 5))
#pre
for i in range(15):
    path = 'data/pre/' + str(i + 1) + '.csv'
    #將V前1萬5千筆讀出來並分析,skiprows為跳過第一個row
    V = pd.read_csv(path, skiprows=1)['V'][0:20004]
    pre[i, 0] = np.std(V) / np.mean(V)  #離散係數
    pre[i, 1] = np.max(V) - np.min(V)  #極差
    pre[i, 2] = sts.skewness(V)  #偏度
    pre[i, 3] = sts.kurtosis(V)  #峰度
    #pre 為0
    pre[i, 4] = '0'
コード例 #12
0
import numpy as np
import stats as sts
a = [31, 24, 23, 25, 14, 25, 13, 12, 14, 23,
          32, 34, 43, 41, 21, 23, 26, 26, 34, 42,
          43, 25, 24, 23, 24, 44, 23, 14, 52,32,
          42, 44, 35, 28, 17, 21, 32, 42, 12, 34]
scores=np.array(a)
print('總合為:',np.sum(scores))
print('筆數為:',len(scores))
print('平均值為:',np.mean(scores))
print('中位數為:',np.median(scores))
print('眾數為:',sts.mode(scores))
print('上四分位數為',sts.quantile(scores,p=0.25))
print('下四分位數為',sts.quantile(scores,p=0.75))
print('最大值:',np.max(scores))
print('最小值:',np.min(scores))
print('全距:',np.ptp(scores))
print('標準差:',np.std(scores))
print('變異數:',np.var(scores))
print('離散係數:',np.std(scores)/np.mean(scores))
print('偏態係數:',sts.skewness(scores))
print('峰態係數:',sts.kurtosis(scores))
コード例 #13
0
print 'harmonicmean:', stats.harmonicmean(l), stats.harmonicmean(
    lf), stats.harmonicmean(a), stats.harmonicmean(af)
print 'mean:', stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af)
print 'median:', stats.median(l), stats.median(lf), stats.median(
    a), stats.median(af)
print 'medianscore:', stats.medianscore(l), stats.medianscore(
    lf), stats.medianscore(a), stats.medianscore(af)
print 'mode:', stats.mode(l), stats.mode(a)

print '\nMOMENTS'
print 'moment:', stats.moment(l), stats.moment(lf), stats.moment(
    a), stats.moment(af)
print 'variation:', stats.variation(l), stats.variation(a), stats.variation(
    lf), stats.variation(af)
print 'skew:', stats.skew(l), stats.skew(lf), stats.skew(a), stats.skew(af)
print 'kurtosis:', stats.kurtosis(l), stats.kurtosis(lf), stats.kurtosis(
    a), stats.kurtosis(af)
print 'mean:', stats.mean(a), stats.mean(af)
print 'var:', stats.var(a), stats.var(af)
print 'stdev:', stats.stdev(a), stats.stdev(af)
print 'sem:', stats.sem(a), stats.sem(af)
print 'describe:'
print stats.describe(l)
print stats.describe(lf)
print stats.describe(a)
print stats.describe(af)

print '\nFREQUENCY'
print 'freqtable:'
print 'itemfreq:'
print stats.itemfreq(l)
コード例 #14
0
mode1 = stats.mode(list1)  
mode2 = stats.mode(list2)  
median1 = stats.median(list1)  
median2 = stats.median(list2)  
variance1 = stats.variance(list1)  
variance2 = stats.variance(list2)  
standard_deviation1 = stats.SD(list1)  
standard_deviation2 = stats.SD(list2)  
covariance_pop = stats.covariance(list1, list2)  
covariance_sample = stats.covariance(list1, list2, True)  
correlation = stats.correlation(list1, list2)  
skewness_pop1 = stats.skewness(list1)  
skewness_pop2 = stats.skewness(list2)  
skewness_sample1 = stats.skewness(list1, True)  
skewness_sample2 = stats.skewness(list2, True)  
kurtosis_pop1 = stats.kurtosis(list1)  
kurtosis_pop2 = stats.kurtosis(list2)  
kurtosis_sample1 = stats.kurtosis(list1, True)  
kurtosis_sample2 = stats.kurtosis(list2, True)  

print("Total1:", total1)
print("Total2:", total2)
print("Mean1:", mean1)
print("Mean2", mean2)
print("Mode1:", mode1)
print("Mode2:", mode2)
print("Median1:", median1)
print("Median2:", median2)
print("Variance1:", variance1)
print("Variance2:", variance2)
print("Standard Deviation1:", standard_deviation1)
コード例 #15
0
import numpy as np
import stats as sts
scares = [
    31, 24, 23, 25, 14, 25, 13, 12, 14, 23, 32, 34, 43, 41, 21, 23, 26, 26, 34,
    42, 43, 25, 24, 23, 24, 44, 23, 14, 52, 32, 42, 44, 35, 28, 17, 21, 32, 42,
    12, 34
]

print('求和:', np.sum(scares))
print('個數:', len(scares))
print('平均值:', np.mean(scares))
print('中位數:', np.median(scares))
print('眾數:', sts.mode(scares))
print('上四分位數:', sts.quantile(scares, p=0.25))
print('下四分位數:', sts.quantile(scares, p=0.75))

print('最大值:', np.max(scares))
print('最小值:', np.min(scares))
print('極差:', np.std(scares))
print('四分位數:', sts.quantile(scares, p=0.75), sts.quantile(scares, p=0.25))
print('標準差:', np.std(scares))
print('方差', np.var(scares))
print('離散係數', np.std(scares) / np.mean(scares))

print('遍度:', sts.skewness(scares))
print('峰度:', sts.kurtosis(scares))
コード例 #16
0
ファイル: modelcall.py プロジェクト: siagosheva/yasso07ui
 def _fill_moment_results(self):
     """
     Fills the result arrays used for storing the calculated moments
      common format: time, mean, mode, var, skewness, kurtosis,
                     95% confidence lower limit, 95% upper limit
     """
     toprocess = [('stock_tom', self.c_stock, 2),
                  ('stock_woody', self.c_stock, 3),
                  ('stock_non_woody', self.c_stock, 4),
                  ('stock_acid', self.c_stock, 5),
                  ('stock_water', self.c_stock, 6),
                  ('stock_ethanol',  self.c_stock, 7),
                  ('stock_non_soluble', self.c_stock, 8),
                  ('stock_humus', self.c_stock, 9),
                  ('change_tom', self.c_change, 2),
                  ('change_woody', self.c_change, 3),
                  ('change_non_woody', self.c_change, 4),
                  ('change_acid', self.c_change, 5),
                  ('change_water', self.c_change, 6),
                  ('change_ethanol', self.c_change, 7),
                  ('change_non_soluble', self.c_change, 8),
                  ('change_humus', self.c_change, 9),
                  ('co2', self.co2_yield, 2)]
     for (resto, dataarr, dataind) in toprocess:
         # filter time steps
         ts = numpy.unique(dataarr[:,1])
         # extract data for the timestep
         for timestep in ts:
             ind = numpy.where(dataarr[:,1]==timestep)
             mean = stats.mean(dataarr[ind[0], dataind])
             mode_res = stats.mode(dataarr[ind[0], dataind])
             mode = mode_res[0]
             var = stats.var(dataarr[ind[0], dataind])
             skew = stats.skew(dataarr[ind[0], dataind])
             kurtosis = stats.kurtosis(dataarr[ind[0], dataind])
             if var>0.0:
                 sd2 = 2 * math.sqrt(var)
             else:
                 sd2 = var
             res = [[timestep, mean, mode[0], var, skew, kurtosis,
                    mean - sd2, mean + sd2]]
             if resto=='stock_tom':
                 self.md.stock_tom = numpy.append(self.md.stock_tom,
                                                  res, axis=0)
             elif resto=='stock_woody':
                 self.md.stock_woody = numpy.append(self.md.stock_woody,
                                                    res, axis=0)
             elif resto=='stock_non_woody':
                 self.md.stock_non_woody = numpy.append(\
                         self.md.stock_non_woody, res, axis=0)
             elif resto=='stock_acid':
                 self.md.stock_acid = numpy.append(self.md.stock_acid,
                                                   res, axis=0)
             elif resto=='stock_water':
                 self.md.stock_water = numpy.append(self.md.stock_water,
                                                    res, axis=0)
             elif resto=='stock_ethanol':
                 self.md.stock_ethanol = numpy.append(self.md.stock_ethanol,
                                                      res, axis=0)
             elif resto=='stock_non_soluble':
                 self.md.stock_non_soluble= numpy.append(
                                     self.md.stock_non_soluble, res, axis=0)
             elif resto=='stock_humus':
                 self.md.stock_humus = numpy.append(self.md.stock_humus,
                                                    res, axis=0)
             elif resto=='change_tom':
                 self.md.change_tom = numpy.append(self.md.change_tom,
                                                   res, axis=0)
             elif resto=='change_woody':
                 self.md.change_woody = numpy.append(self.md.change_woody,
                                                     res, axis=0)
             elif resto=='change_non_woody':
                 self.md.change_non_woody = numpy.append(\
                         self.md.change_non_woody, res, axis=0)
             elif resto=='change_acid':
                 self.md.change_acid = numpy.append(self.md.change_acid,
                                                    res, axis=0)
             elif resto=='change_water':
                 self.md.change_water = numpy.append(self.md.change_water,
                                                     res, axis=0)
             elif resto=='change_ethanol':
                 self.md.change_ethanol = numpy.append(
                                         self.md.change_ethanol, res, axis=0)
             elif resto=='change_non_soluble':
                 self.md.change_non_soluble=numpy.append(
                                     self.md.change_non_soluble, res, axis=0)
             elif resto=='change_humus':
                 self.md.change_humus = numpy.append(self.md.change_humus,
                                                     res, axis=0)
             elif resto=='co2':
                 self.md.co2 = numpy.append(self.md.co2, res, axis=0)
コード例 #17
0
 def kurtosis(self, data):
     print('峰度:', sts.kurtosis(data))
コード例 #18
0
ファイル: traithull.py プロジェクト: dschwilk/traithull
def G2(vals) :
    """Calculates the adjusted and corrected kurtosis (G2) as
    defined on pg 115 of Sokal and Rohlf"""
    n = len(vals)
    if n < 4 : return -99  # hack
    return ((n+1)*n*stats.kurtosis(vals)) / ((n-1) * (n-2)) - ((3*(n-1)*(n-1))/((n-2)*(n-3)))
コード例 #19
0
def Ts_Kurtosis(x, n):
    return stats.kurtosis(x[-n:])
コード例 #20
0
print('方差', df['身高'].var())
print('标准差', df['身高'].std())
print('极差', df['身高'].max() - df['身高'].min())

print('偏度', df['身高'].skew())
print('峰度', df['身高'].kurt())

import numpy as np
import stats as sts
scores = [1, 2, 2, 2, 5]
#集中趋势的度量
print('求和:', np.sum(scores))
print('个数:', len(scores))
print('平均值:', np.mean(scores))
print('中位数:', np.median(scores))
print('众数:', sts.mode(scores))
print('上四分位数', sts.quantile(scores, p=0.25))
print('下四分位数', sts.quantile(scores, p=0.75))
#离散趋势的度量
print('最大值:', np.max(scores))
print('最小值:', np.min(scores))
print('极差:', np.max(scores) - np.min(scores))
print('四分位差', sts.quantile(scores, p=0.75) - sts.quantile(scores, p=0.25))
print('标准差:', np.std(scores))
print('方差:', np.var(scores))
print('离散系数:', np.std(scores) / np.mean(scores))
#偏度与峰度的度量
print('偏度:', sts.skewness(scores))
print('峰度:', sts.kurtosis(scores))
コード例 #21
0
print('平均值:', np.mean(data))
print('中位数:', np.median(data))
print('众数:', sts.mode(data))
print('上四分位数', sts.quantile(data, p=0.25))
print('下四分位数', sts.quantile(data, p=0.75))
#离散趋势的度量
print('最大值:', np.max(data))
print('最小值:', np.min(data))
print('极差:', np.max(data) - np.min(data))
print('四分位差', sts.quantile(data, p=0.75) - sts.quantile(data, p=0.25))
print('标准差:', np.std(data))
print('方差:', np.var(data))
print('变异系数:', np.std(data) / np.mean(data))
#偏度与峰度的度量
print('偏度:', sts.skewness(data))
print('峰度:', sts.kurtosis(data))

# 随机生成两个样本
x = np.random.randint(0, 9, 1000)
y = np.random.randint(0, 9, 1000)

# 计算平均值
mx = x.mean()
my = y.mean()

# 计算标准差
stdx = x.std()
stdy = y.std()

# 计算协方差矩阵
covxy = np.cov(x, y)
コード例 #22
0
ファイル: statstest.py プロジェクト: mozilla/jx-sqlite
af = N.array(lf)
ll = [l]*5
aa = N.array(ll)

print('\nCENTRAL TENDENCY')
print('geometricmean:',stats.geometricmean(l), stats.geometricmean(lf), stats.geometricmean(a), stats.geometricmean(af))
print('harmonicmean:',stats.harmonicmean(l), stats.harmonicmean(lf), stats.harmonicmean(a), stats.harmonicmean(af))
print('mean:',stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af))
print('median:',stats.median(l),stats.median(lf),stats.median(a),stats.median(af))
print('medianscore:',stats.medianscore(l),stats.medianscore(lf),stats.medianscore(a),stats.medianscore(af))
print('mode:',stats.mode(l),stats.mode(a))
print('\nMOMENTS')
print('moment:',stats.moment(l),stats.moment(lf),stats.moment(a),stats.moment(af))
print('variation:',stats.variation(l),stats.variation(a),stats.variation(lf),stats.variation(af))
print('skew:',stats.skew(l),stats.skew(lf),stats.skew(a),stats.skew(af))
print('kurtosis:',stats.kurtosis(l),stats.kurtosis(lf),stats.kurtosis(a),stats.kurtosis(af))
print('mean:',stats.mean(a),stats.mean(af))
print('var:',stats.var(a),stats.var(af))
print('stdev:',stats.stdev(a),stats.stdev(af))
print('sem:',stats.sem(a),stats.sem(af))
print('describe:')
print(stats.describe(l))
print(stats.describe(lf))
print(stats.describe(a))
print(stats.describe(af))
print('\nFREQUENCY')
print('freqtable:')
print('itemfreq:')
print(stats.itemfreq(l))
print(stats.itemfreq(a))
print('scoreatpercentile:',stats.scoreatpercentile(l,40),stats.scoreatpercentile(lf,40),stats.scoreatpercentile(a,40),stats.scoreatpercentile(af,40))
コード例 #23
0
 def _fill_moment_results(self):
     """
     Fills the result arrays used for storing the calculated moments
      common format: time, mean, mode, var, skewness, kurtosis,
                     95% confidence lower limit, 95% upper limit
     """
     toprocess = [('stock_tom', self.c_stock, 2),
                  ('stock_woody', self.c_stock, 3),
                  ('stock_non_woody', self.c_stock, 4),
                  ('stock_acid', self.c_stock, 5),
                  ('stock_water', self.c_stock, 6),
                  ('stock_ethanol', self.c_stock, 7),
                  ('stock_non_soluble', self.c_stock, 8),
                  ('stock_humus', self.c_stock, 9),
                  ('change_tom', self.c_change, 2),
                  ('change_woody', self.c_change, 3),
                  ('change_non_woody', self.c_change, 4),
                  ('change_acid', self.c_change, 5),
                  ('change_water', self.c_change, 6),
                  ('change_ethanol', self.c_change, 7),
                  ('change_non_soluble', self.c_change, 8),
                  ('change_humus', self.c_change, 9),
                  ('co2', self.co2_yield, 2)]
     for (resto, dataarr, dataind) in toprocess:
         # filter time steps
         ts = numpy.unique(dataarr[:, 1])
         # extract data for the timestep
         for timestep in ts:
             ind = numpy.where(dataarr[:, 1] == timestep)
             mean = stats.mean(dataarr[ind[0], dataind])
             mode_res = stats.mode(dataarr[ind[0], dataind])
             mode = mode_res[0]
             var = stats.var(dataarr[ind[0], dataind])
             skew = stats.skew(dataarr[ind[0], dataind])
             kurtosis = stats.kurtosis(dataarr[ind[0], dataind])
             if var > 0.0:
                 sd2 = 2 * math.sqrt(var)
             else:
                 sd2 = var
             res = [[
                 timestep, mean, mode[0], var, skew, kurtosis, mean - sd2,
                 mean + sd2
             ]]
             if resto == 'stock_tom':
                 self.md.stock_tom = numpy.append(self.md.stock_tom,
                                                  res,
                                                  axis=0)
             elif resto == 'stock_woody':
                 self.md.stock_woody = numpy.append(self.md.stock_woody,
                                                    res,
                                                    axis=0)
             elif resto == 'stock_non_woody':
                 self.md.stock_non_woody = numpy.append(\
                         self.md.stock_non_woody, res, axis=0)
             elif resto == 'stock_acid':
                 self.md.stock_acid = numpy.append(self.md.stock_acid,
                                                   res,
                                                   axis=0)
             elif resto == 'stock_water':
                 self.md.stock_water = numpy.append(self.md.stock_water,
                                                    res,
                                                    axis=0)
             elif resto == 'stock_ethanol':
                 self.md.stock_ethanol = numpy.append(self.md.stock_ethanol,
                                                      res,
                                                      axis=0)
             elif resto == 'stock_non_soluble':
                 self.md.stock_non_soluble = numpy.append(
                     self.md.stock_non_soluble, res, axis=0)
             elif resto == 'stock_humus':
                 self.md.stock_humus = numpy.append(self.md.stock_humus,
                                                    res,
                                                    axis=0)
             elif resto == 'change_tom':
                 self.md.change_tom = numpy.append(self.md.change_tom,
                                                   res,
                                                   axis=0)
             elif resto == 'change_woody':
                 self.md.change_woody = numpy.append(self.md.change_woody,
                                                     res,
                                                     axis=0)
             elif resto == 'change_non_woody':
                 self.md.change_non_woody = numpy.append(\
                         self.md.change_non_woody, res, axis=0)
             elif resto == 'change_acid':
                 self.md.change_acid = numpy.append(self.md.change_acid,
                                                    res,
                                                    axis=0)
             elif resto == 'change_water':
                 self.md.change_water = numpy.append(self.md.change_water,
                                                     res,
                                                     axis=0)
             elif resto == 'change_ethanol':
                 self.md.change_ethanol = numpy.append(
                     self.md.change_ethanol, res, axis=0)
             elif resto == 'change_non_soluble':
                 self.md.change_non_soluble = numpy.append(
                     self.md.change_non_soluble, res, axis=0)
             elif resto == 'change_humus':
                 self.md.change_humus = numpy.append(self.md.change_humus,
                                                     res,
                                                     axis=0)
             elif resto == 'co2':
                 self.md.co2 = numpy.append(self.md.co2, res, axis=0)