dataset added

This commit is contained in:
Hladu357 2024-10-18 21:02:29 +02:00
parent 784926e111
commit 909ceda055
2 changed files with 187 additions and 6 deletions

View File

@ -1,7 +1,15 @@
FROM python:3.10-slim
RUN pip install --upgrade pip \
&& pip install jupyter notebook
RUN apt-get update && apt-get install -y --no-install-recommends \
r-base && \
R --quiet -e "install.packages('Sleuth2')" && \
R --quiet -e "library(Sleuth2); write.csv(ex0221, file = \"data.csv\")" && \
apt-get purge -y r-base && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip && \
pip install jupyter notebook pandas numpy matplotlib
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--allow-root", "--no-browser"]

View File

@ -2,11 +2,184 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "7c90184c-5f76-4277-b0ad-aeec2ac37d30",
"execution_count": 1,
"id": "d693757b-4f3a-4162-9300-ec96596a26ec",
"metadata": {},
"outputs": [],
"source": []
"source": [
"#import csv\n",
"#import math\n",
"#import numpy as np\n",
"#import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"#np.set_printoptions(precision=3)\n",
"#from sympy import *\n",
"#from scipy.stats import norm, uniform, expon, t\n",
"#from scipy.optimize import minimize"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7c90184c-5f76-4277-b0ad-aeec2ac37d30",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n"
]
}
],
"source": [
"K = 28\n",
"L = 8\n",
"M = (((K + L) * 47) % 11) + 1\n",
"print(M)"
]
},
{
"cell_type": "markdown",
"id": "503f77b6-1c9d-4406-8b30-ec3b792267e7",
"metadata": {},
"source": [
"(1b) Načtěte datový soubor a rozdělte sledovanou proměnnou na příslušné dvě pozorované skupiny.\n",
"Stručně popište data a zkoumaný problém. Pro každou skupinu zvlášť odhadněte střední hodnotu, rozptyl a medián příslušného rozdělení."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "b80d5cec-db0c-42e7-a3b9-296803242269",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" ,\"Weight\",\"Status\"\n",
"0 1,24.5,\"survived\"\n",
"1 2,26.8999996185303,\"survived\"\n",
"2 3,26.8999996185303,\"survived\"\n",
"3 4,24.2999992370605,\"survived\"\n",
"4 5,24.1000003814697,\"survived\"\n",
"5 6,26.5,\"survived\"\n",
"6 7,24.6000003814697,\"survived\"\n",
"7 8,24.2000007629395,\"survived\"\n",
"8 9,23.6000003814697,\"survived\"\n",
"9 10,26.2000007629395,\"survived\"\n",
"10 11,26.2000007629395,\"survived\"\n",
"11 12,24.7999992370605,\"survived\"\n",
"12 13,25.3999996185303,\"survived\"\n",
"13 14,23.7000007629395,\"survived\"\n",
"14 15,25.7000007629395,\"survived\"\n",
"15 16,25.7000007629395,\"survived\"\n",
"16 17,26.2999992370605,\"survived\"\n",
"17 18,26.7000007629395,\"survived\"\n",
"18 19,23.8999996185303,\"survived\"\n",
"19 20,24.7000007629395,\"survived\"\n",
"20 21,28,\"survived\"\n",
"21 22,27.8999996185303,\"survived\"\n",
"22 23,25.8999996185303,\"survived\"\n",
"23 24,25.7000007629395,\"survived\"\n",
"24 25,26.6000003814697,\"survived\"\n",
"25 26,23.2000007629395,\"survived\"\n",
"26 27,25.7000007629395,\"survived\"\n",
"27 28,26.2999992370605,\"survived\"\n",
"28 29,24.2999992370605,\"survived\"\n",
"29 30,26.7000007629395,\"survived\"\n",
"30 31,24.8999996185303,\"survived\"\n",
"31 32,23.7999992370605,\"survived\"\n",
"32 33,25.6000003814697,\"survived\"\n",
"33 34,27,\"survived\"\n",
"34 35,24.7000007629395,\"survived\"\n",
"35 36,26.5,\"perished\"\n",
"36 37,26.1000003814697,\"perished\"\n",
"37 38,25.6000003814697,\"perished\"\n",
"38 39,25.8999996185303,\"perished\"\n",
"39 40,25.5,\"perished\"\n",
"40 41,27.6000003814697,\"perished\"\n",
"41 42,25.7999992370605,\"perished\"\n",
"42 43,24.8999996185303,\"perished\"\n",
"43 44,26,\"perished\"\n",
"44 45,26.5,\"perished\"\n",
"45 46,26,\"perished\"\n",
"46 47,27.1000003814697,\"perished\"\n",
"47 48,25.1000003814697,\"perished\"\n",
"48 49,26,\"perished\"\n",
"49 50,25.6000003814697,\"perished\"\n",
"50 51,25,\"perished\"\n",
"51 52,24.6000003814697,\"perished\"\n",
"52 53,25,\"perished\"\n",
"53 54,26,\"perished\"\n",
"54 55,28.2999992370605,\"perished\"\n",
"55 56,24.6000003814697,\"perished\"\n",
"56 57,27.5,\"perished\"\n",
"57 58,31.1000003814697,\"perished\"\n",
"58 59,28.2999992370605,\"perished\"\n"
]
}
],
"source": [
"df = pd.read_csv(\"/data.csv\", sep = \";\", decimal = \",\")\n",
"print(df)"
]
},
{
"cell_type": "markdown",
"id": "29eef015-c103-4e7f-89e8-2b59526f4b1e",
"metadata": {},
"source": [
"(1b) Pro každou skupinu zvlášť odhadněte hustotu a distribuční funkci pomocí histogramu a empirické distribuční funkce."
]
},
{
"cell_type": "markdown",
"id": "626d8bce-65af-4659-96e9-c1fbe4ccb3cc",
"metadata": {},
"source": [
"(3b) Pro každou skupinu zvlášť najděte nejbližší rozdělení: \n",
"Odhadněte parametry normálního, exponenciálního a rovnoměrného rozdělení.\n",
"Zaneste příslušné hustoty s odhadnutými parametry do grafů histogramu. Diskutujte, které z rozdělení odpovídá pozorovaným datům nejlépe."
]
},
{
"cell_type": "markdown",
"id": "6226456c-fdf3-4537-830c-05f8ee7022c5",
"metadata": {},
"source": [
"(1b) Pro každou skupinu zvlášť vygenerujte náhodný výběr o 100 hodnotách z rozdělení, \n",
"které jste zvolili jako nejbližší, s parametry odhadnutými v předchozím bodě.\n",
"Porovnejte histogram simulovaných hodnot s pozorovanými daty."
]
},
{
"cell_type": "markdown",
"id": "1c5f7d31-ca21-42b4-9a23-1111bbf599b9",
"metadata": {},
"source": [
"(1b) Pro každou skupinu zvlášť spočítejte oboustranný 95% konfidenční interval pro střední hodnotu."
]
},
{
"cell_type": "markdown",
"id": "53a61e4f-fc67-4237-ab38-f5f9fb7767c5",
"metadata": {},
"source": [
"(1b) Pro každou skupinu zvlášť otestujte na hladině významnosti 5 % hypotézu,\n",
"zda je střední hodnota rovná hodnotě K (parametr úlohy), proti oboustranné alternativě.\n",
"Můžete použít buď výsledek z předešlého bodu, nebo výstup z příslušné vestavěné funkce vašeho softwaru."
]
},
{
"cell_type": "markdown",
"id": "7007c195-97a3-4cd4-8427-dcc8417eedf8",
"metadata": {},
"source": [
"(2b) Na hladině významnosti 5 % otestujte, jestli mají pozorované skupiny stejnou střední hodnotu.\n",
"Typ testu a alternativy stanovte tak, aby vaše volba nejlépe korespondovala s povahou zkoumaného problému."
]
}
],
"metadata": {