Files
applied-statistics/exam/main.py
2025-12-23 13:24:45 +03:00

32 lines
597 B
Python

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()