<jupyter_start><jupyter_text>Плотности распределения Стьюдента<jupyter_code>grid = np.linspace(-7, 7, 1000)
plt.figure(figsize=(12, 5))
plt.plot(grid, sps.t(df=1).pdf(grid), label='df=1', lw=5, alpha=0.6)
plt.plot(grid, sps.t(df=3).pdf(grid), label='df=3', lw=5, alpha=0.6)
plt.plot(grid, sps.t(df=100).pdf(grid), label='df=100', lw=5, alpha=0.6)
plt.plot(grid, sps.norm.pdf(grid), '--', lw=2, label='norm')
plt.plot(grid, sps.cauchy.pdf(grid), '--', lw=2, label='cauchy')
plt.grid(ls=':')
plt.legend(fontsize=16)
plt.show()<jupyter_output><empty_output><jupyter_text>Плотности распределения Фишера<jupyter_code>grid = np.linspace(0, 3, 1000)
plt.figure(figsize=(12, 5))
plt.plot(grid, sps.f(dfn=1, dfd=1).pdf(grid), label='dfn=1, dfd=1', lw=3)
plt.plot(grid, sps.f(dfn=3, dfd=3).pdf(grid), label='dfn=3, dfd=3', lw=3)
plt.plot(grid, sps.f(dfn=10, dfd=10).pdf(grid), label='dfn=10, dfd=10', lw=3)
plt.plot(grid, sps.f(dfn=30, dfd=30).pdf(grid), label='dfn=30, dfd=30', lw=3)
plt.plot(grid, sps.f(dfn=200, dfd=200).pdf(grid), label='dfn=200, dfd=200', lw=3)
plt.grid(ls=':')
plt.legend(fontsize=16)
plt.ylim((0, 3))
plt.show()<jupyter_output>/usr/local/lib/python3.5/dist-packages/scipy/stats/_continuous_distns.py:1415: RuntimeWarning: divide by zero encountered in log
  lPx = m/2 * log(m) + n/2 * log(n) + (n/2 - 1) * log(x)<jupyter_text><NAME>$H_0: F = G$$H_1: F \not= G$`ks_2samp``(data1, data2): statistic, pvalue`<jupyter_code>sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=1).rvs(size=100)
sps.ks_2samp(sample_1, sample_2)
sample_1 = sps.norm(loc=0, scale=1).rvs(size=100)
sample_2 = sps.norm(loc=0, scale=2).rvs(size=100)
sps.ks_2samp(sample_1, sample_2)
sample_1 = sps.norm(loc=0, scale=1).rvs(size=30)
sample_2 = sps.norm(loc=0, scale=2).rvs(size=500)
sps.ks_2samp(sample_1, sample_2)
sample_1 = sps.norm(loc=0, scale=1).rvs(size=300)
sample_2 = sps.norm(loc=0, scale=1).rvs(size=500)
sps.ks_2samp(sample_1, sample_2)
sample_1 = sps.norm.rvs(size=100)
sample_2 = sps.cauchy.rvs(size=100)
sps.ks_2samp(sample_1, sample_2)
sample_1 = sps.norm.rvs(size=100)
sample_2 = sps.laplace.rvs(size=100)
sps.ks_2samp(sample_1, sample_2)<jupyter_output><empty_output><jupyter_text>Критерий ранговых сумм Уилкоксона (независимые выборки)$H_0: F = G$$H_1: F \leqslant G \text{ или } F \geqslant G$ `ranksums``(data1, data2): statistic, pvalue`<jupyter_code>sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=1).rvs(size=100)
sps.ranksums(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=0).rvs(size=100)
sps.ranksums(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=1, scale=10).rvs(size=100)
sps.ranksums(sample_1, sample_2)
sample_1 = sps.cauchy(loc=0).rvs(size=100)
sample_2 = sps.cauchy(loc=1).rvs(size=100)
sps.ranksums(sample_1, sample_2)<jupyter_output><empty_output><jupyter_text>Критерий ранговых сумм Уилкоксона (парные выборки)$H_0: F = G$$H_1: F \leqslant G \text{ или } F \geqslant G$ `wilcoxon``(x, y=None, zero_method='wilcox'): statistic, pvalue``x`, `y` --- выборки. Если `y=None`, то в `x` разности.`zero_method : {“pratt”, “wilcox”, “zsplit”}`<jupyter_code>sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sample_1 + sps.norm(loc=0, scale=0.5).rvs(size=100)
sps.wilcoxon(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sample_1 + sps.norm(loc=0.5, scale=0.5).rvs(size=100)
sps.wilcoxon(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sample_1 + sps.norm(loc=-0.5, scale=0.5).rvs(size=100)
sps.wilcoxon(sample_1, sample_2)<jupyter_output><empty_output><jupyter_text>Времена реакции (Лагутин, стр. 221)<jupyter_code>sample_1 = [176, 163, 152, 155, 156, 178, 160, 164, 169, 155, 122, 144]
sample_2 = [168, 215, 172, 200, 191, 197, 183, 174, 176, 155, 115, 163]
sps.wilcoxon(sample_1, sample_2)<jupyter_output><empty_output><jupyter_text>Одновыборочный T-критерий$X_1, ..., X_n \sim \mathcal{N}(\mu, \sigma^2)$$H_0: \mu = \mu_0$$H_1: \mu \not= \mu_0$ `ttest_1samp``(a, popmean): statistic, pvalue``a` --- выборка`popmean` --- равно $\mu_0$<jupyter_code>sample = sps.norm(loc=0).rvs(size=100)
sps.ttest_1samp(sample, 0), sps.ttest_1samp(sample, 0.5)<jupyter_output><empty_output><jupyter_text>Двухвыборочный T-критерий Стьюдента (Аспина-Уэлша) - независимые выборкиДаны две независимые выборки$X_1, ..., X_n \sim \mathcal{N}(\mu_1, \sigma_1^2)$$Y_1, ..., Y_m \sim \mathcal{N}(\mu_2, \sigma_2^2)$$H_0: \mu_1 = \mu_2$$H_1: \mu_1 \not= \mu_2$ `ttest_ind``(a, b, equal_var=True): statistic, pvalue``a`, `b` --- выборка`equal_var` --- известно ли равенство дисперсий<jupyter_code>sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=1).rvs(size=100)
sps.ttest_ind(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sps.norm(loc=1, scale=3).rvs(size=100)
sps.ttest_ind(sample_1, sample_2), sps.ttest_ind(sample_1, sample_2, equal_var=False)<jupyter_output><empty_output><jupyter_text>Двухвыборочный T-критерий Стьюдента - связные выборкиДаны две связные выборки$X_1, ..., X_n \sim \mathcal{N}(\mu_1, \sigma_1^2)$$Y_1, ..., Y_т \sim \mathcal{N}(\mu_2, \sigma_2^2)$$H_0: \mu_1 = \mu_2$$H_1: \mu_1 \not= \mu_2$ `ttest_rel``(a, b): statistic, pvalue``a`, `b` --- выборка<jupyter_code>sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sample_1 + sps.norm(loc=0, scale=0.5).rvs(size=100)
sps.ttest_rel(sample_1, sample_2)
sample_1 = sps.norm(loc=0).rvs(size=100)
sample_2 = sample_1 + sps.norm(loc=0.5, scale=0.5).rvs(size=100)
sps.ttest_rel(sample_1, sample_2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2034779490856938, 'fraction_numerical': 0.08336321262101111, 'mean_word_length': 6.9134751773049645, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '355778', 'license': 'MIT', 'n_tokens_mistral': 2980, 'n_tokens_neox': 2778, 'n_words': 378, 'path': '06_two_sample_variance_analysis/seminar_6.ipynb', 'repo_name': 'ilivans/mipt-math-stats', 'size': '5589'}