Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bedartha Goswami
uncertise
Commits
23def4fc
Commit
23def4fc
authored
Jun 18, 2020
by
Andyara Callegare
Browse files
more stat functions
parent
b8960945
Changes
1
Hide whitespace changes
Inline
Side-by-side
distributions.py
View file @
23def4fc
...
...
@@ -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-
Quart
ile Range for the paleo dataset.
Returns the Inter-
Dec
ile Range for the paleo dataset.
"""
nt
=
cdfmat
.
shape
[
0
]
_printmsg
(
"Estimating I
Q
R of total proxy probability..."
,
verbose
)
_printmsg
(
"Estimating I
D
R 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment