-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheffects.py
38 lines (31 loc) · 1.1 KB
/
effects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as np
from scipy.stats import beta, norm, truncnorm, wald
class Effects:
def __init__(self, n_intervals):
self.n_intervals = n_intervals
def yonas_1(self):
a, b = 5, 20
x_sim = np.linspace(beta.ppf(0.01, a, b), beta.ppf(0.99, a, b),
self.n_intervals)
y = np.exp(beta.pdf(x_sim, a, b) / 4)
y -= y.min() - 1
return y
def yonas_2(self):
y = np.repeat(4, self.n_intervals)
return y
def yonas_3(self):
a, b = 0, 3
x_sim = np.linspace(truncnorm.ppf(0.01, a, b),
truncnorm.ppf(0.99, a, b), self.n_intervals)
x = np.arange(self.n_intervals)
y = np.exp(truncnorm.pdf(x_sim, a, b) * 1.35)
return y
def yonas_4(self):
a, b = 1, 3
x_sim = np.linspace(beta.ppf(0.01, a, b), beta.ppf(0.99, a, b),
self.n_intervals)
y = np.exp(beta.pdf(x_sim, a, b) / 2.15)
return y
@staticmethod
def negative_effect(positive_effect):
return np.exp(-np.log(positive_effect))