misc. changes

This commit is contained in:
s444501 2022-05-13 22:06:56 +02:00
parent 7e0cf14302
commit 642ba2b80a

View File

@ -1,8 +1,31 @@
{ {
"cells": [ "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", "cell_type": "code",
"execution_count": 46, "execution_count": 50,
"metadata": { "metadata": {
"pycharm": { "pycharm": {
"name": "#%%\n" "name": "#%%\n"
@ -19,7 +42,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 47, "execution_count": 51,
"metadata": { "metadata": {
"pycharm": { "pycharm": {
"name": "#%%\n" "name": "#%%\n"
@ -29,14 +52,14 @@
"source": [ "source": [
"def generate_bootstraps(data, n_bootstraps=100):\n", "def generate_bootstraps(data, n_bootstraps=100):\n",
" data_size = data.shape[0]\n", " data_size = data.shape[0]\n",
" for b in range(n_bootstraps):\n", " for _ in range(n_bootstraps):\n",
" indicies = np.random.choice(len(data), size=data_size)\n", " indices = np.random.choice(len(data), size=data_size)\n",
" yield data.iloc[indicies, :]" " yield data.iloc[indices, :]"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 52,
"outputs": [], "outputs": [],
"source": [ "source": [
"def get_t_stat(data1, data2):\n", "def get_t_stat(data1, data2):\n",
@ -57,7 +80,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 49, "execution_count": 53,
"metadata": { "metadata": {
"pycharm": { "pycharm": {
"name": "#%%\n" "name": "#%%\n"
@ -80,7 +103,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50, "execution_count": 54,
"outputs": [], "outputs": [],
"source": [ "source": [
"def make_decision(data, columns, alpha=0.05):\n", "def make_decision(data, columns, alpha=0.05):\n",
@ -104,13 +127,29 @@
}, },
{ {
"cell_type": "code", "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": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "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", "\n",
"Reject the null hypothesis that the means are equal.\n", "Reject the null hypothesis that the means are equal.\n",
"Reject the null hypothesis that the means are equal.\n" "Reject the null hypothesis that the means are equal.\n"