From 642ba2b80af208b0169f0ac184a21ef030e77acb Mon Sep 17 00:00:00 2001 From: s444501 Date: Fri, 13 May 2022 22:06:56 +0200 Subject: [PATCH] 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"