Commit 23def4fc authored by Andyara Callegare's avatar Andyara Callegare
Browse files

more stat functions

parent b8960945
......@@ -75,22 +75,54 @@ def inter_quartile_range_2(cdfmat, var_span, verbose=False):
for i in range(nt):
cdfhist += cdfmat[i]
cdfhist /= float(nt)
q3, q1 = np.percentile(cdfhist, [75,25])
q2 = np.median(cdfhist)
q3, q2, q1 = np.percentile(cdfhist, [75,50,25])
iqr = q3-q1
return iqr, q1, q2, q3
def inter_mean_range(cdfmat, var_span, verbose=False):
def inter_decile_range(cdfmat, var_span, verbose=False):
"""
Returns the Inter-Quartile Range for the paleo dataset.
Returns the Inter-Decile Range for the paleo dataset.
"""
nt = cdfmat.shape[0]
_printmsg("Estimating IQR of total proxy probability...", verbose)
_printmsg("Estimating IDR of total proxy probability...", verbose)
cdfhist = np.zeros(len(var_span))
for i in range(nt):
cdfhist += cdfmat[i]
cdfhist /= float(nt)
qHi = np.interp(0.50, cdfhist, var_span)
iqr = qHi
return iqr
q3, q2, q1 = np.percentile(cdfhist, [10,50,90])
idr = q3-q1
return idr, q1, q2, q3
def midhinge(cdfmat, var_span, verbose=False):
"""
Returns the midhinge e for the paleo dataset.
"""
nt = cdfmat.shape[0]
_printmsg("Estimating MH of total proxy probability...", verbose)
cdfhist = np.zeros(len(var_span))
for i in range(nt):
cdfhist += cdfmat[i]
cdfhist /= float(nt)
q3, q2, q1 = np.percentile(cdfhist, [25,50,75])
mh = 2*((q3+q2+q1)/4) - q2
return mh, q1, q2, q3
def basic_stats(cdfmat, var_span, verbose=False):
"""
Returns the basic stats for the paleo dataset.
"""
nt = cdfmat.shape[0]
_printmsg("Estimating basic stats of total proxy probability...", verbose)
cdfhist = np.zeros(len(var_span))
for i in range(nt):
cdfhist += cdfmat[i]
cdfhist /= float(nt)
median = np.percentile(cdfhist, 5)
max = np.max(cdfhist)
mean = np.mean(cdfhist)
min = np.min(cdfhist)
return median, max, mean, min
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment