Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from scipy.stats import chi2
- def confidence_interval_variance(data, confidence_level):
- n = len(data)
- dof = n - 1
- alpha = 1 - confidence_level
- sample_variance = np.var(data, ddof=1)
- lower_bound = (n - 1) * sample_variance / chi2.ppf(1 - alpha/2, dof)
- upper_bound = (n - 1) * sample_variance / chi2.ppf(alpha/2, dof)
- return lower_bound, upper_bound
- # Пример использования
- data = [2, 4, 6, 8, 10]
- confidence_level = 0.95
- lower, upper = confidence_interval_variance(data, confidence_level)
- print(f"Доверительный интервал дисперсии: [{lower}, {upper}]")
- from scipy.stats import f_oneway
- def test_equal_variances(data1, data2):
- statistic, p_value = f_oneway(data1, data2)
- return statistic, p_value
- # Пример использования
- data1 = [2, 4, 6, 8, 10]
- data2 = [1, 3, 5, 7, 9]
- statistic, p_value = test_equal_variances(data1, data2)
- print(f"Статистика теста: {statistic}")
- print(f"p-значение: {p_value}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement