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": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8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utu+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"