2022-05-11 15:02:15 +02:00
|
|
|
{
|
|
|
|
"cells": [
|
2022-05-13 22:06:56 +02:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
|
|
|
"Bootstrapowa wersja testu t.\n",
|
|
|
|
"Implementacja powinna obejmować test dla jednej próby, dla dwóch prób niezależnych oraz dla dwóch prób zależnych.\n",
|
|
|
|
"W każdej sytuacji oczekiwanym wejście jest zbiór danych w odpowiednim formacie, a wyjściem p-wartość oraz ostateczna decyzja.\n",
|
|
|
|
"Dodatkowo powinien być rysowany odpowiedni rozkład statystyki testowej."
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
|
|
|
"Zbiór danych - ???\n",
|
|
|
|
"Hipoteza zerowa - ???\n",
|
2022-05-13 23:43:00 +02:00
|
|
|
"Hipoteza alternatywna - ???\n",
|
|
|
|
"\n",
|
|
|
|
"Dla każdego z 3 testów inne\n",
|
|
|
|
"https://www.jmp.com/en_ch/statistics-knowledge-portal/t-test.html"
|
2022-05-13 22:06:56 +02:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false
|
|
|
|
}
|
|
|
|
},
|
2022-05-11 15:02:15 +02:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 120,
|
2022-05-11 15:02:15 +02:00
|
|
|
"metadata": {
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import pandas as pd\n",
|
|
|
|
"from math import sqrt\n",
|
|
|
|
"from scipy.stats import sem\n",
|
2022-05-13 23:43:00 +02:00
|
|
|
"from scipy.stats import t\n",
|
2022-05-14 15:31:47 +02:00
|
|
|
"import matplotlib.pyplot as plt\n",
|
2022-05-14 16:40:40 +02:00
|
|
|
"from statistics import mean, stdev\n",
|
|
|
|
"from scipy.stats import ttest_ind, ttest_1samp, ttest_rel"
|
2022-05-11 15:02:15 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 121,
|
2022-05-11 15:02:15 +02:00
|
|
|
"metadata": {
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def generate_bootstraps(data, n_bootstraps=100):\n",
|
|
|
|
" data_size = data.shape[0]\n",
|
2022-05-13 22:06:56 +02:00
|
|
|
" for _ in range(n_bootstraps):\n",
|
|
|
|
" indices = np.random.choice(len(data), size=data_size)\n",
|
|
|
|
" yield data.iloc[indices, :]"
|
2022-05-11 15:02:15 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 122,
|
2022-05-11 15:02:15 +02:00
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def get_t_stat(data1, data2):\n",
|
|
|
|
" mean1 = np.mean(data1)\n",
|
|
|
|
" mean2 = np.mean(data2)\n",
|
|
|
|
" sem1 = sem(data1)\n",
|
|
|
|
" sem2 = sem(data2)\n",
|
|
|
|
"\n",
|
|
|
|
" sed = sqrt(sem1**2.0 + sem2**2.0)\n",
|
|
|
|
" return (mean1 - mean2) / sed"
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 123,
|
2022-05-14 15:31:47 +02:00
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def t_stat_single(sample, population_mean):\n",
|
|
|
|
" \"\"\"Funkcja oblicza wartość statystyki testowej dla jednej próbki\"\"\"\n",
|
|
|
|
" sample_size = len(sample)\n",
|
2022-05-14 16:40:40 +02:00
|
|
|
" return (mean(sample) - population_mean) / (stdev(sample) / sqrt(sample_size))"
|
2022-05-14 15:31:47 +02:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 124,
|
2022-05-14 15:31:47 +02:00
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2022-05-14 16:40:40 +02:00
|
|
|
"def t_stat_indept(sample_1, sample_2):\n",
|
|
|
|
" \"\"\"Funkcja oblicza wartość statystyki testowej dla dwóch próbek niezależnych\"\"\"\n",
|
|
|
|
" # get_t_stat() jest ok już chyba dla równolicznych sampli o tej samej wariancji\n",
|
|
|
|
" return"
|
2022-05-14 15:31:47 +02:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 125,
|
2022-05-14 15:31:47 +02:00
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2022-05-14 16:40:40 +02:00
|
|
|
"def t_stat_dep(sample_1, sample_2):\n",
|
|
|
|
" \"\"\"Funkcja oblicza wartość statystyki testowej dla dwóch próbek zależnych\"\"\"\n",
|
|
|
|
" differences = [x_1 - x_2 for x_1, x_2 in zip(sample_1, sample_2)]\n",
|
|
|
|
" sample_size = len(sample_1)\n",
|
|
|
|
" mu = 0 # The constant = zero if we want to test whether the average of the difference is significantly different.\n",
|
|
|
|
" return (mean(differences) - mu) / (stdev(differences) / sqrt(sample_size))"
|
2022-05-14 15:31:47 +02:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 126,
|
2022-05-11 15:02:15 +02:00
|
|
|
"metadata": {
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def independent_t_test(data, columns, alpha=0.05):\n",
|
|
|
|
" t_stat_sum = 0\n",
|
|
|
|
" for sample in generate_bootstraps(data):\n",
|
|
|
|
" t_stat_sum += get_t_stat(sample[columns[0]], sample[columns[1]])\n",
|
|
|
|
"\n",
|
|
|
|
" data_size = data.shape[0]\n",
|
|
|
|
" t_stat = t_stat_sum / data_size\n",
|
|
|
|
" df = 2 * data_size - 2\n",
|
|
|
|
" cv = t.ppf(1.0 - alpha, df)\n",
|
|
|
|
" p = (1.0 - t.cdf(abs(t_stat), df)) * 2.0\n",
|
|
|
|
" return t_stat, df, cv, p"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 127,
|
2022-05-11 15:02:15 +02:00
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"def make_decision(data, columns, alpha=0.05):\n",
|
|
|
|
" t_stat, df, cv, p = independent_t_test(data, columns, alpha)\n",
|
|
|
|
" print(f't: {t_stat}, df: {df}, cv: {cv}, p: {p}\\n')\n",
|
|
|
|
" if abs(t_stat) <= cv:\n",
|
|
|
|
"\t print('Accept null hypothesis that the means are equal.')\n",
|
|
|
|
" else:\n",
|
|
|
|
" print('Reject the null hypothesis that the means are equal.')\n",
|
|
|
|
" if p > alpha:\n",
|
|
|
|
" print('Accept null hypothesis that the means are equal.')\n",
|
|
|
|
" else:\n",
|
|
|
|
"\t print('Reject the null hypothesis that the means are equal.')"
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 128,
|
2022-05-13 23:43:00 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": "<Figure size 432x288 with 1 Axes>",
|
2022-05-14 16:40:40 +02:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAP2UlEQVR4nO3df4xlZX3H8fdHVrBqK+COW7pLOpuKbaipilNK48+CqQjGpa0lEFO3SrLRqsUfrS7aiEljsqjVatLabIW6tgShSMu21FbcYkmTsjog8htZEWTXhR3jz9ZERb/9454tt8PM7s49M3tnHt6vZHLPeZ5z5nyfPTOfOfe5595NVSFJasvjxl2AJGnxGe6S1CDDXZIaZLhLUoMMd0lq0KpxFwCwevXqmpycHHcZkrSi3Hjjjd+oqom5+pZFuE9OTjI9PT3uMiRpRUly/3x9TstIUoMMd0lqkOEuSQ0y3CWpQYa7JDXIcJekBhnuktQgw12SGmS4S1KDlsU7VKXlbHLzNWM57n1bzhzLcdUGr9wlqUGGuyQ1yHCXpAYZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5JDTLcJalBhrskNchwl6QGGe6S1CDDXZIaZLhLUoMOGu5J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mlfuktSgJQv3JKcnuTvJriSbl+o4kqRHW5JwT3IE8BfAy4ATgXOTnLgUx5IkPdpSXbmfDOyqqnur6ofAJ4ENS3QsSdIsS/WC6lrggaH13cCvDW+QZBOwqVv97yR3L1EtB7Ia+MYYjruYWhgDtDEOx7B8rJhx5KJ5uw5lDD8/X8fY7papqq3A1nEdHyDJdFVNjbOGvloYA7QxDsewfLQwjr5jWKppmT3A8UPr67o2SdJhsFTh/gXghCTrkxwJnANsX6JjSZJmWZJpmap6OMkbgX8DjgAuqarbl+JYPY1
|
2022-05-13 23:43:00 +02:00
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2022-05-13 22:06:56 +02:00
|
|
|
"source": [
|
|
|
|
"def draw_distribution():\n",
|
|
|
|
" \"\"\"Funkcja rysuje rozkład statystyki testowej\"\"\"\n",
|
2022-05-13 23:43:00 +02:00
|
|
|
" dummy = np.random.normal(170, 10, 500)\n",
|
|
|
|
" plt.hist(dummy)\n",
|
|
|
|
" plt.show()\n",
|
|
|
|
" pass\n",
|
|
|
|
"draw_distribution()"
|
2022-05-13 22:06:56 +02:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-05-14 16:40:40 +02:00
|
|
|
"execution_count": 129,
|
2022-05-11 15:02:15 +02:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2022-05-14 16:40:40 +02:00
|
|
|
"Statystyka testowa dla jednej próby:\n",
|
|
|
|
"1.414213562373095 - z naszej funkcji\n",
|
|
|
|
"1.414213562373095 - z gotowej biblioteki\n",
|
|
|
|
"\n",
|
|
|
|
"Statystyka testowa dla dwóch prób niezależnych:\n",
|
|
|
|
"-3.0 - z naszej funkcji\n",
|
|
|
|
"-3.0 - z gotowej biblioteki\n",
|
|
|
|
"\n",
|
|
|
|
"Statystyka testowa dla dwóch prób zależnych:\n",
|
|
|
|
"-1.6329931618554525 - z naszej funkcji\n",
|
|
|
|
"-1.632993161855452 - z gotowej biblioteki\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"# Testy\n",
|
|
|
|
"dummy = [1, 2, 3, 4, 5]\n",
|
|
|
|
"dummy2 = [4, 5, 6, 7, 8]\n",
|
|
|
|
"dummy3 = [1, 3 , 3, 4, 6]\n",
|
|
|
|
"t_stat_selfmade = t_stat_single(dummy, 2)\n",
|
|
|
|
"t_stat_lib, _ = ttest_1samp(dummy, 2)\n",
|
|
|
|
"print('Statystyka testowa dla jednej próby:')\n",
|
|
|
|
"print(t_stat_selfmade, '- z naszej funkcji')\n",
|
|
|
|
"print(t_stat_lib, '- z gotowej biblioteki')\n",
|
|
|
|
"print()\n",
|
|
|
|
"t_stat_selfmade = get_t_stat(dummy, dummy2)\n",
|
|
|
|
"t_stat_lib, _ = ttest_ind(dummy, dummy2)\n",
|
|
|
|
"print('Statystyka testowa dla dwóch prób niezależnych:')\n",
|
|
|
|
"print(t_stat_selfmade, '- z naszej funkcji')\n",
|
|
|
|
"print(t_stat_lib, '- z gotowej biblioteki')\n",
|
|
|
|
"print()\n",
|
|
|
|
"t_stat_selfmade = t_stat_dep(dummy, dummy3)\n",
|
|
|
|
"t_stat_lib, _ = ttest_rel(dummy, dummy3)\n",
|
|
|
|
"print('Statystyka testowa dla dwóch prób zależnych:')\n",
|
|
|
|
"print(t_stat_selfmade, '- z naszej funkcji')\n",
|
|
|
|
"print(t_stat_lib, '- z gotowej biblioteki')"
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 130,
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"t: 6.89001510574949, df: 998, cv: 1.6463818766348755, p: 9.867218153658541e-12\n",
|
2022-05-11 15:02:15 +02:00
|
|
|
"\n",
|
|
|
|
"Reject the null hypothesis that the means are equal.\n",
|
|
|
|
"Reject the null hypothesis that the means are equal.\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"dataset = pd.read_csv('experiment_data.csv')\n",
|
|
|
|
"make_decision(dataset, ['Weight', 'Age'])"
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"collapsed": false,
|
|
|
|
"pycharm": {
|
|
|
|
"name": "#%%\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"interpreter": {
|
|
|
|
"hash": "11938c6bc6919ae2720b4d5011047913343b08a43b18698fd82dedb0d4417594"
|
|
|
|
},
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Python 3.9.1 64-bit",
|
|
|
|
"language": "python",
|
|
|
|
"name": "python3"
|
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"codemirror_mode": {
|
|
|
|
"name": "ipython",
|
|
|
|
"version": 3
|
|
|
|
},
|
|
|
|
"file_extension": ".py",
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
"name": "python",
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
"version": "3.9.1"
|
|
|
|
},
|
|
|
|
"orig_nbformat": 4
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 2
|
|
|
|
}
|