From 642ba2b80af208b0169f0ac184a21ef030e77acb Mon Sep 17 00:00:00 2001 From: s444501 Date: Fri, 13 May 2022 22:06:56 +0200 Subject: [PATCH 1/8] misc. changes --- bootstrap-t.ipynb | 59 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index cd93786..af28d86 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -1,8 +1,31 @@ { "cells": [ + { + "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", + "Hipoteza alternatywna - ???" + ], + "metadata": { + "collapsed": false + } + }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 50, "metadata": { "pycharm": { "name": "#%%\n" @@ -19,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 51, "metadata": { "pycharm": { "name": "#%%\n" @@ -29,14 +52,14 @@ "source": [ "def generate_bootstraps(data, n_bootstraps=100):\n", " data_size = data.shape[0]\n", - " for b in range(n_bootstraps):\n", - " indicies = np.random.choice(len(data), size=data_size)\n", - " yield data.iloc[indicies, :]" + " for _ in range(n_bootstraps):\n", + " indices = np.random.choice(len(data), size=data_size)\n", + " yield data.iloc[indices, :]" ] }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 52, "outputs": [], "source": [ "def get_t_stat(data1, data2):\n", @@ -57,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 53, "metadata": { "pycharm": { "name": "#%%\n" @@ -80,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 54, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", @@ -104,13 +127,29 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 55, + "outputs": [], + "source": [ + "def draw_distribution():\n", + " \"\"\"Funkcja rysuje rozkład statystyki testowej\"\"\"\n", + " pass" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 56, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.903407918031469, df: 998, cv: 1.6463818766348755, p: 9.018563673635072e-12\n", + "t: 6.891235313595221, df: 998, cv: 1.6463818766348755, p: 9.78683800667568e-12\n", "\n", "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" -- 2.20.1 From d445516c2ca023870bd9fd7443c1ee420372643c Mon Sep 17 00:00:00 2001 From: s444501 Date: Fri, 13 May 2022 23:43:00 +0200 Subject: [PATCH 2/8] basic histogram with dummy data --- bootstrap-t.ipynb | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index af28d86..76523f4 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -17,7 +17,10 @@ "source": [ "Zbiór danych - ???\n", "Hipoteza zerowa - ???\n", - "Hipoteza alternatywna - ???" + "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" ], "metadata": { "collapsed": false @@ -25,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 52, "metadata": { "pycharm": { "name": "#%%\n" @@ -37,12 +40,13 @@ "import pandas as pd\n", "from math import sqrt\n", "from scipy.stats import sem\n", - "from scipy.stats import t" + "from scipy.stats import t\n", + "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 53, "metadata": { "pycharm": { "name": "#%%\n" @@ -59,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 54, "outputs": [], "source": [ "def get_t_stat(data1, data2):\n", @@ -69,6 +73,7 @@ " sem2 = sem(data2)\n", "\n", " sed = sqrt(sem1**2.0 + sem2**2.0)\n", + " # To jest wzór chyba tylko dla jednego przypadku\n", " return (mean1 - mean2) / sed" ], "metadata": { @@ -80,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 55, "metadata": { "pycharm": { "name": "#%%\n" @@ -103,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 56, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", @@ -127,12 +132,27 @@ }, { "cell_type": "code", - "execution_count": 55, - "outputs": [], + "execution_count": 69, + "outputs": [ + { + "data": { + "text/plain": "
", + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAP20lEQVR4nO3df4xlZX3H8fdHVrBqK+COW7pLOpuKbaipilNK48+CqQjGpa0lkKZulWSjVYs/Wl20EZPGZFGr1aS12Qp1bQlCkRZaaitSLGlSVgdEfiMrLrK4sGP82Zqo6Ld/3LPlZp1lZ++5w527z/uVTO45zznnnu+TM/cz5z73njOpKiRJh77HTboASdJjw8CXpEYY+JLUCANfkhph4EtSI1ZNugCA1atX1+zs7KTLkKSpcuONN369qmaWuv6KCPzZ2Vnm5+cnXYYkTZUk9x3M+g7pSFIjDHxJaoSBL0mNMPAlqREGviQ1wsCXpEYY+JLUCANfkhph4EtSI1bElbbSSja7+eqJ7HfnltMnsl8dujzDl6RGGPiS1IgDBn6Si5LsSXLbUNv7ktyV5JYk/5jkyKFl5y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p3t+hBYE03fVD9mrrAT/JE4B3AuyZdy5h9BPgF4NnAbgZDBtNsFXA0g7eZfwJc1p0ZHwrO5pGz+2n3OuDNVXUs8GbgwgnX09drgD9MciODIZEfTLiekSR5MvBJ4E1V9Z3hZTUYyxnp+/RTF/gMQnE98MUkOxnctuGmJD/LFN/SoaoeqqofVdWPgb/hkbeb09qnXcAV3VvNzwE/ZnDjp2ntDwBJVgG/DVw61DzNfdoIXNFN/wNT/ntXVXdV1W9W1XMZ/FH+crdoavqT5PEMwv7iqtp7bB7aO1TTPe4dIj2ofk1d4FfVrVX1tKqarapZBsFyQlU9yOD2Da/qPrk+Cfj20NugFW2fcbffAvZ+8+Aq4KwkRyRZDxwHfO6xrm8E/8Tgg1uSPAM4nMFd/qa1P3u9BLirqnYNtU1zn74GvKibPhnYO0w1la+lJE/rHh8H/Cnw192iqThG3bvgC4E7q+oDQ4uuYvDHme7xyqH2pR+nSX8qvYRPrS9hMMTxQwbhfs4+y3fyyLd0wuAfr3wZuBWYm3T9S+0T8Hddzbd0B/GYofXf2fXpbrpvVKykn/3053Dg7xn84boJOHla+vNov3fAx4DXLrL+VPYJeD5wI4NvsGwHntutu+JfS/vpz7kMvtnyJWAL3d0EpugYPZ/BcM0twM3dz2nAU4FrGfxB/gxw9CjHyVsrSFIjpm5IR5I0GgNfkhph4EtSIwx8SWqEgS9JjTDwJakRBr4kNeL/AH3XBGX1ayAXAAAAAElFTkSuQmCC\n" + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "def draw_distribution():\n", " \"\"\"Funkcja rysuje rozkład statystyki testowej\"\"\"\n", - " pass" + " dummy = np.random.normal(170, 10, 500)\n", + " plt.hist(dummy)\n", + " plt.show()\n", + " pass\n", + "draw_distribution()" ], "metadata": { "collapsed": false, @@ -143,13 +163,13 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 60, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.891235313595221, df: 998, cv: 1.6463818766348755, p: 9.78683800667568e-12\n", + "t: 6.893215520199072, df: 998, cv: 1.6463818766348755, p: 9.657386002004387e-12\n", "\n", "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" -- 2.20.1 From 0c0ba5643089179904c3d3aca0ede00311d0c48c Mon Sep 17 00:00:00 2001 From: test Date: Sat, 14 May 2022 15:31:47 +0200 Subject: [PATCH 3/8] test statistic function for one sample --- bootstrap-t.ipynb | 70 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index 76523f4..c62c3ed 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 15, "metadata": { "pycharm": { "name": "#%%\n" @@ -41,12 +41,13 @@ "from math import sqrt\n", "from scipy.stats import sem\n", "from scipy.stats import t\n", - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "from statistics import mean, stdev" ] }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 16, "metadata": { "pycharm": { "name": "#%%\n" @@ -63,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 17, "outputs": [], "source": [ "def get_t_stat(data1, data2):\n", @@ -85,7 +86,56 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, + "outputs": [], + "source": [ + "def t_stat_single(sample, population_mean):\n", + " \"\"\"Funkcja oblicza wartość statystyki testowej dla jednej próbki\"\"\"\n", + " sample_mean = mean(sample)\n", + " sample_std = stdev(sample)\n", + " sample_size = len(sample)\n", + " return (sample_mean - population_mean) / (sample_std / sqrt(sample_size))" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "def t_stat_indept():\n", + " pass" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "def t_stat_dep():\n", + " pass" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 18, "metadata": { "pycharm": { "name": "#%%\n" @@ -108,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 19, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", @@ -132,12 +182,12 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 20, "outputs": [ { "data": { "text/plain": "
", - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAP20lEQVR4nO3df4xlZX3H8fdHVrBqK+COW7pLOpuKbaipilNK48+CqQjGpa0lkKZulWSjVYs/Wl20EZPGZFGr1aS12Qp1bQlCkRZaaitSLGlSVgdEfiMrLrK4sGP82Zqo6Ld/3LPlZp1lZ++5w527z/uVTO45zznnnu+TM/cz5z73njOpKiRJh77HTboASdJjw8CXpEYY+JLUCANfkhph4EtSI1ZNugCA1atX1+zs7KTLkKSpcuONN369qmaWuv6KCPzZ2Vnm5+cnXYYkTZUk9x3M+g7pSFIjDHxJaoSBL0mNMPAlqREGviQ1wsCXpEYY+JLUCANfkhph4EtSI1bElbbSSja7+eqJ7HfnltMnsl8dujzDl6RGGPiS1IgDBn6Si5LsSXLbUNv7ktyV5JYk/5jkyKFl5yXZkeTuJC9dprolSQdpKWf4HwNO3aftGuCZVfUrwJeA8wCSHA+cBfxyt81fJTlsbNVKkkZ2wMCvquuBb+zT9umqeribvQFY101vAD5RVd+vqq8AO4ATx1ivJGlE4xjDfw3wqW56LXD/0LJdXdtPSLIpyXyS+YWFhTGUIUl6NL0CP8k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VgI92V8qOyv7v9Wt3f3q3d4yTgucD1DP6JfgE4dNT29/DD2w9IUoOaHpaRpJ9XhrskNchwl6QGGe6S1CDDXZIaZLhLUoMMd0lq0P8B851KdtKAlogAAAAASUVORK5CYII=\n" }, "metadata": { "needs_background": "light" @@ -163,13 +213,13 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 21, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.893215520199072, df: 998, cv: 1.6463818766348755, p: 9.657386002004387e-12\n", + "t: 6.940510630195086, df: 998, cv: 1.6463818766348755, p: 7.02371494298859e-12\n", "\n", "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" -- 2.20.1 From 7caf329f2de59c677f2b8e6502feb1323cbb0a4f Mon Sep 17 00:00:00 2001 From: test Date: Sat, 14 May 2022 16:40:40 +0200 Subject: [PATCH 4/8] test statistic functions for all 3 tests --- bootstrap-t.ipynb | 98 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 77 insertions(+), 21 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index c62c3ed..7535ea9 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 120, "metadata": { "pycharm": { "name": "#%%\n" @@ -42,12 +42,13 @@ "from scipy.stats import sem\n", "from scipy.stats import t\n", "import matplotlib.pyplot as plt\n", - "from statistics import mean, stdev" + "from statistics import mean, stdev\n", + "from scipy.stats import ttest_ind, ttest_1samp, ttest_rel" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 121, "metadata": { "pycharm": { "name": "#%%\n" @@ -64,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 122, "outputs": [], "source": [ "def get_t_stat(data1, data2):\n", @@ -74,7 +75,6 @@ " sem2 = sem(data2)\n", "\n", " sed = sqrt(sem1**2.0 + sem2**2.0)\n", - " # To jest wzór chyba tylko dla jednego przypadku\n", " return (mean1 - mean2) / sed" ], "metadata": { @@ -86,15 +86,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 123, "outputs": [], "source": [ "def t_stat_single(sample, population_mean):\n", " \"\"\"Funkcja oblicza wartość statystyki testowej dla jednej próbki\"\"\"\n", - " sample_mean = mean(sample)\n", - " sample_std = stdev(sample)\n", " sample_size = len(sample)\n", - " return (sample_mean - population_mean) / (sample_std / sqrt(sample_size))" + " return (mean(sample) - population_mean) / (stdev(sample) / sqrt(sample_size))" ], "metadata": { "collapsed": false, @@ -105,11 +103,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 124, "outputs": [], "source": [ - "def t_stat_indept():\n", - " pass" + "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" ], "metadata": { "collapsed": false, @@ -120,11 +120,15 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 125, "outputs": [], "source": [ - "def t_stat_dep():\n", - " pass" + "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))" ], "metadata": { "collapsed": false, @@ -135,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 126, "metadata": { "pycharm": { "name": "#%%\n" @@ -158,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 127, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", @@ -182,12 +186,12 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 128, "outputs": [ { "data": { "text/plain":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0myAdhTVV+a1TXXxyWsPWyFjeaN3dOzS/Y/dWNljeMZwAuS7EzyH0l+tWtfSWMY9gLgoaq6p1tfSeN4M/D+JA8AHwAu6NpX0hhu55HPr/pdHnkT5bIfQ5JJ4DnATmBNVe3tuh4E1nTLCx7HYybckzwReCfw7nHXsgg+CvwC8GxgL4PpgJVmFXAsg6eYfwxc0V39rlTn8shV+0rzeuAtVXU88Bbg4jHXM4rXAn+Q5EYG0xw/HHM9hyTJk4FPAW+uqu8O99VgPmbke9UfM+HOIAzXA19Kch+Dj0S4KcnPssI+LqGqHqqqH1fVT4C/5pGnmStpHLuBq7qnmZ8HfsLgg5JW0hgASLIK+G3g8qHmlTSOjcBV3fLfswJ/nqrqrqr6zap6LoM/sl/pupbtGJI8nkGwX1pV+//9H9o/3dI97p+uXPA4HjPhXlW3VtXTqmqyqiYZhMtJVfUgg49GeHX3ivQpwHeGnhotO7Pm2n4L2H/XwHbgnCRHJVkPnAB8/nDXd4j+kcGLqiR5BnAkg0/AW0lj2O8lwF1VtXuobSWN4+vAi7rlU4H9U0sr5vciydO6x8cBfwL8Vde1LM9D9yz1YuDOqvrgUNd2Bn9s6R6vHmpf2LkY96vGS/hq9GUMpix+xCDIz5vVfx+P3C0TBv+5yFeAW4Gpcdd/oHEAf9vVeUt30o8b2v5d3TjuprsDYtxf84zhSODvGPxhugk4dTmP4UA/U8DHgdfNsf2yG8c85+L5wI0M7irZCTy323ZZ/l7MM4bzGdxx8mVgC92775fxeXg+gymXW4Cbu68zgKcCOxj8gf0scOyo58KPH5CkBj1mpmUk6bHEcJekBhnuktQgw12SGmS4S1KDDHdJapDhLkkN+l9FDOaKE4lTmQAAAABJRU5ErkJggg==\n" }, "metadata": { "needs_background": "light" @@ -213,13 +217,65 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 129, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.940510630195086, df: 998, cv: 1.6463818766348755, p: 7.02371494298859e-12\n", + "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", "\n", "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" -- 2.20.1 From 3c3ed25e63e1a7152a4319359f6b3e00590e1208 Mon Sep 17 00:00:00 2001 From: test Date: Sat, 14 May 2022 16:47:42 +0200 Subject: [PATCH 5/8] delete old function --- bootstrap-t.ipynb | 55 +++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index 7535ea9..338ab8f 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 142, "metadata": { "pycharm": { "name": "#%%\n" @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 143, "metadata": { "pycharm": { "name": "#%%\n" @@ -65,28 +65,7 @@ }, { "cell_type": "code", - "execution_count": 122, - "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", - "execution_count": 123, + "execution_count": 144, "outputs": [], "source": [ "def t_stat_single(sample, population_mean):\n", @@ -103,13 +82,13 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 145, "outputs": [], "source": [ - "def t_stat_indept(sample_1, sample_2):\n", + "def t_stat_ind(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" + " sed = sqrt(sem(sample_1)**2 + sem(sample_2)**2)\n", + " return (mean(sample_1) - mean(sample_2)) / sed" ], "metadata": { "collapsed": false, @@ -120,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 146, "outputs": [], "source": [ "def t_stat_dep(sample_1, sample_2):\n", @@ -139,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 147, "metadata": { "pycharm": { "name": "#%%\n" @@ -150,7 +129,7 @@ "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", + " t_stat_sum += t_stat_ind(sample[columns[0]], sample[columns[1]])\n", "\n", " data_size = data.shape[0]\n", " t_stat = t_stat_sum / data_size\n", @@ -162,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 148, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", @@ -186,12 +165,12 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 149, "outputs": [ { "data": { "text/plain": "
", - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAP2UlEQVR4nO3df4xlZX3H8fdHVrBqK+COW7pLOpuKbaipilNK48+CqQjGpa0lEFO3SrLRqsUfrS7aiEljsqjVatLabIW6tgShSMu21FbcYkmTsjog8htZEWTXhR3jz9ZERb/9454tt8PM7s49M3tnHt6vZHLPeZ5z5nyfPTOfOfe5595NVSFJasvjxl2AJGnxGe6S1CDDXZIaZLhLUoMMd0lq0KpxFwCwevXqmpycHHcZkrSi3Hjjjd+oqom5+pZFuE9OTjI9PT3uMiRpRUly/3x9TstIUoMMd0lqkOEuSQ0y3CWpQYa7JDXIcJekBhnuktQgw12SGmS4S1KDlsU7VKXlbHLzNWM57n1bzhzLcdUGr9wlqUGGuyQ1yHCXpAYZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5JDTLcJalBhrskNchwl6QGGe6S1CDDXZIaZLhLUoMOGu5JLkmyL8ltQ23vT3JXkluS/EOSo4f6LkiyK8ndSV66RHVLkg7gUK7cPw6cPqv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Dc/Z9BPiVeY49F/hn4CRgI/CvwAmTnsMyzvuHgb8DThq2X7cW5n3U878L/OZqm/dLvOd/C7xjePxO4L45j/8KCHAhsGfS41/meX8OeMvw+L3Ab3V9z9f0CryqPg3824iHbwFurqpvVNUXgf3M3k6gnQXm/T5gR1V9Yzjm2WH/ap83MLvqBC4Dbhp2rZp5w4JzL+Dw6vM1wJeHx1uAP6lZnwFOTnLGyox0eS0w73OATw+P7wZ+anjc7j1f0wF/Ce8fvnW8Mckpw775bh2wfuWHNjbnAG9KsifJPyT5gWH/ap/3YW8Cnqmqx4bttTDvDwK/k+RJ4KPANcP+1T73fRy5b9NPc+QDie3mbcBf7OPAdwPnAYeY/bZ6LVgHnMrst8y/Ctw6rErXindzZPW9VrwPuLqqzgKuBnZNeDwr5b3ALybZC3w78NyEx3PMxn4vlG6q6pnDj5P8MfCpYXO13zrgIHB7zV4M/GySbzJ7o5/VPm+SrAN+Evj+ObtX/byBrcBVw+M/BW4YHq/quVfVI8CPACQ5B9g8PNVu3q7Aj3LUtb6fAA7/9PpO4PIkJyXZCJwNfHalxzdGf87sDzIP/099IrN3aVvt8wZ4G/BIVR2cs28tzPvLwFuGxxcDhy8f3Qn83PDbKBcCX6+qQ5MY4Dgked3w9RXAbwB/NDzV7j1f0yvwJDcBbwVOS3IQuBZ4a5LzmP0BzwHgFwCqal+SW4GHgOeBK6vq/yYw7CVbYN43AjcOv271HLB1WI2v6nlX1S5m7+Pzgssnq+n9hgXf858Hrh++A/kfjtz2+S+Z/U2U/cB/A+9Z8QEvkwXm/eokVw6H3A58Anq+536UXpKa8hKKJDVlwCWpKQMuSU0ZcElqyoBLUlMGXJKaMuCS1NT/A059g8y1NrEyAAAAAElFTkSuQmCC\n" }, "metadata": { "needs_background": "light" @@ -217,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 150, "outputs": [ { "name": "stdout", @@ -248,7 +227,7 @@ "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_selfmade = t_stat_ind(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", @@ -269,13 +248,13 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 151, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.89001510574949, df: 998, cv: 1.6463818766348755, p: 9.867218153658541e-12\n", + "t: 6.914346193374633, df: 998, cv: 1.6463818766348755, p: 8.378631122241131e-12\n", "\n", "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" -- 2.20.1 From e2ff7032bfe4a51987e38179c1f054648d25b6a9 Mon Sep 17 00:00:00 2001 From: test Date: Sat, 14 May 2022 17:09:29 +0200 Subject: [PATCH 6/8] declare test functions --- bootstrap-t.ipynb | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index 338ab8f..eb9d804 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -106,7 +106,7 @@ " \"\"\"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", + " mu = 0 # The constant is 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))" ], "metadata": { @@ -116,6 +116,51 @@ } } }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "def bootstrap_one_sample():\n", + " return" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "def bootstrap_independent():\n", + " return" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "def bootstrap_dependent():\n", + " return" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, { "cell_type": "code", "execution_count": 147, -- 2.20.1 From 0f1d0b16c0fd52c81e01bb93900d3ab499d3e919 Mon Sep 17 00:00:00 2001 From: test Date: Sat, 14 May 2022 18:13:51 +0200 Subject: [PATCH 7/8] comments --- bootstrap-t.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index eb9d804..770549f 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -226,11 +226,11 @@ "source": [ "def draw_distribution():\n", " \"\"\"Funkcja rysuje rozkład statystyki testowej\"\"\"\n", + " # Losowe dane bo nie jestem pewien co tu dać teraz\n", " dummy = np.random.normal(170, 10, 500)\n", " plt.hist(dummy)\n", " plt.show()\n", - " pass\n", - "draw_distribution()" + "draw_distribution() # To trzeba wywalić potem" ], "metadata": { "collapsed": false, -- 2.20.1 From f2a8b2c167f10611dde29794347d51126192a8c6 Mon Sep 17 00:00:00 2001 From: s444501 Date: Mon, 16 May 2022 18:52:49 +0200 Subject: [PATCH 8/8] histogram --- bootstrap-t.ipynb | 86 ++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/bootstrap-t.ipynb b/bootstrap-t.ipynb index 770549f..8c2b43d 100644 --- a/bootstrap-t.ipynb +++ b/bootstrap-t.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 142, + "execution_count": 239, "metadata": { "pycharm": { "name": "#%%\n" @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 143, + "execution_count": 240, "metadata": { "pycharm": { "name": "#%%\n" @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 144, + "execution_count": 241, "outputs": [], "source": [ "def t_stat_single(sample, population_mean):\n", @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 242, "outputs": [], "source": [ "def t_stat_ind(sample_1, sample_2):\n", @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 243, "outputs": [], "source": [ "def t_stat_dep(sample_1, sample_2):\n", @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 244, "outputs": [], "source": [ "def bootstrap_one_sample():\n", @@ -133,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 245, "outputs": [], "source": [ "def bootstrap_independent():\n", @@ -148,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 246, "outputs": [], "source": [ "def bootstrap_dependent():\n", @@ -163,7 +163,7 @@ }, { "cell_type": "code", - "execution_count": 147, + "execution_count": 247, "metadata": { "pycharm": { "name": "#%%\n" @@ -173,25 +173,28 @@ "source": [ "def independent_t_test(data, columns, alpha=0.05):\n", " t_stat_sum = 0\n", + " t_stat_list = []\n", " for sample in generate_bootstraps(data):\n", - " t_stat_sum += t_stat_ind(sample[columns[0]], sample[columns[1]])\n", - "\n", + " stat = t_stat_ind(sample[columns[0]], sample[columns[1]])\n", + " t_stat_list.append(stat)\n", + " t_stat_sum += stat\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" + " return t_stat, df, cv, p, t_stat_list" ] }, { "cell_type": "code", - "execution_count": 148, + "execution_count": 248, "outputs": [], "source": [ "def make_decision(data, columns, alpha=0.05):\n", - " t_stat, df, cv, p = independent_t_test(data, columns, alpha)\n", + " t_stat, df, cv, p, stats = independent_t_test(data, columns, alpha)\n", " print(f't: {t_stat}, df: {df}, cv: {cv}, p: {p}\\n')\n", + " draw_distribution(stats)\n", " if abs(t_stat) <= cv:\n", "\t print('Accept null hypothesis that the means are equal.')\n", " else:\n", @@ -210,27 +213,18 @@ }, { "cell_type": "code", - "execution_count": 149, - "outputs": [ - { - "data": { - "text/plain": "
", - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAMkElEQVR4nO3dfYxl9V3H8fenrKBttUCZElyIu7GgISaluCKG9EFotO0aF7USGqOblrim0kqpD12MkSb+s2i1YmJqVpZmTRoeRCJYfEIEGxO77WyLwvIQVrqUpQtMY1ufYhH79Y85mx2WGeayM3fufmfer4TMPeeeu+f3yyXv/ObM3DOpKiRJ/bxi0gOQJB0bAy5JTRlwSWrKgEtSUwZckppat5InO+2002rDhg0reUpJam/v3r1fqaqpo/evaMA3bNjA9PT0Sp5SktpL8sR8+72EIklNGXBJasqAS1JTBlySmjLgktSUAZekpgy4JDVlwCWpKQMuSU2t6CcxpePVhu13TezcB3Zsnti51ZsrcElqyhW4jiuTXAlL3bgCl6SmDLgkNWXAJakpAy5JTRlwSWrKgEtSUwZckpoy4JLUlAGXpKYMuCQ1ZcAlqSkDLklNGXBJasqAS1JTBlySmjLgktSUAZekpgy4JDVlwCWpKQMuSU0ZcElqyoBLUlMGXJKaMuCS1JQBl6SmDLgkNTVSwJNcnWRfkgeT3JTkW5NsTLInyf4ktyQ5cdyDlSQdsWjAk6wHfgnYVFXfB5wAXA5cB3ysql4PfBW4YpwDlSS90KiXUNYB35ZkHfBK4BBwMXDb8Pxu4NJlH50kaUGLBryqngI+CnyJ2XB/HdgLfK2qnh8OOwisn+/1SbYlmU4yPTMzszyjliSNdAnlFGALsBH4TuBVwNtHPUFV7ayqTVW1aWpq6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8PNVu3q7Aj3LUtb6fAA7/9PpO4PIkJyXZCJwNfHalxzdGf87sDzIP/099IrN3aVvt8wZ4G/BIVR2cs28tzPvLwFuGxxcDhy8f3Qn83PDbKBcCX6+qQ5MY4Dgked3w9RXAbwB/NDzV7j1f0yvwJDcBbwVOS3IQuBZ4a5LzmP0BzwHgFwCqal+SW4GHgOeBK6vq/yYw7CVbYN43AjcOv271HLB1WI2v6nlX1S5m7+Pzgssnq+n9hgXf858Hrh++A/kfjtz2+S+Z/U2U/cB/A+9Z8QEvkwXm/eokVw6H3A58Anq+536UXpKa8hKKJDVlwCWpKQMuSU0ZcElqyoBLUlMGXJKaMuCS1NT/A059g8y1NrEyAAAAAElFTkSuQmCC\n" - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - } - ], + "execution_count": 249, + "outputs": [], "source": [ - "def draw_distribution():\n", - " \"\"\"Funkcja rysuje rozkład statystyki testowej\"\"\"\n", - " # Losowe dane bo nie jestem pewien co tu dać teraz\n", - " dummy = np.random.normal(170, 10, 500)\n", - " plt.hist(dummy)\n", - " plt.show()\n", - "draw_distribution() # To trzeba wywalić potem" + "def draw_distribution(stats): # To powinno być zdefiniowane przed make decision w sumie\n", + " \"\"\"\n", + " Funkcja rysuje rozkład statystyki testowej\n", + " stats: lista statystyk testowych\n", + " \"\"\"\n", + " plt.hist(stats)\n", + " plt.xlabel('Test statistic value')\n", + " plt.ylabel('Frequency')\n", + " plt.show()" ], "metadata": { "collapsed": false, @@ -241,7 +235,7 @@ }, { "cell_type": "code", - "execution_count": 150, + "execution_count": 250, "outputs": [ { "name": "stdout", @@ -293,14 +287,30 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": 251, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "t: 6.914346193374633, df: 998, cv: 1.6463818766348755, p: 8.378631122241131e-12\n", - "\n", + "t: 6.929903381575467, df: 998, cv: 1.6463818766348755, p: 7.544853630747639e-12\n", + "\n" + ] + }, + { + "data": { + "text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K8pSqurGq3gp8mW5c/J3XPxTYVt0oq6+i+4TBCux30pXAaye2P2yBdT4LHA+8hu6PAHRPY/o28P+SHEk3dO9C7krytP49Om2i/ZPAv5447vop26sRBr/Wqofp+qnfmuR6uhEtn0UXyH+U5EbgK8DbqxvL/GPAaQt9uQu8IclNSW4A/h74OF03yUPpHnR9Jt3DdM7oj/VUuqBlgfWWut9J/xE4rN/meh4Z7vi7qns+wmV04X5Z33Z9/996K11//RenvGeb+m3+jEe6xQBeD2zov1C+hbU3MqhWmaNzSlJjPOOXpMYY/JLUGINfkhpj8EtSYwx+SWqMwS9JjTH4JakxBr8kNeb/A8xCTZ43e5wtAAAAAElFTkSuQmCC\n" + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n" ] -- 2.20.1