upd
This commit is contained in:
31
exam/main.py
Normal file
31
exam/main.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from scipy.stats import norm
|
||||
|
||||
def main() -> None:
|
||||
|
||||
data = np.array([float(v) for v in open("data.csv", 'r')])
|
||||
|
||||
n = len(data)
|
||||
x_m = data.mean()
|
||||
s_0 = data.var(ddof=1)
|
||||
|
||||
plt.figure()
|
||||
plt.hist(data, bins = 10, density=True, edgecolor='black')
|
||||
|
||||
a, b = np.histogram(data, bins=10)
|
||||
print(a)
|
||||
|
||||
plt.show()
|
||||
|
||||
tau = norm.ppf(0.975)
|
||||
|
||||
theta_minus = x_m - tau * np.sqrt(s_0 / n)
|
||||
print(theta_minus)
|
||||
theta_plus = x_m + tau * np.sqrt(s_0 / n)
|
||||
print(theta_plus)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user