diff options
Diffstat (limited to 'sem6/prob')
-rw-r--r-- | sem6/prob/stat1/Opgaver.ipynb | 173 | ||||
-rw-r--r-- | sem6/prob/stat2/opgaver.tex | 23 | ||||
-rw-r--r-- | sem6/prob/stat3/Untitled.ipynb | 172 |
3 files changed, 368 insertions, 0 deletions
diff --git a/sem6/prob/stat1/Opgaver.ipynb b/sem6/prob/stat1/Opgaver.ipynb new file mode 100644 index 0000000..b398bfa --- /dev/null +++ b/sem6/prob/stat1/Opgaver.ipynb @@ -0,0 +1,173 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import scipy.stats\n", + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 1" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "# Create data\n", + "c = [ 112, 121, 126, 108, 141, 104, 136, 134,\n", + " 121, 118, 143, 116, 108, 122, 127, 140,\n", + " 113, 117, 126, 130, 134, 120, 131, 133,\n", + " 118, 125, 151, 147, 137, 140, 132, 119,\n", + " 110, 124, 132, 152, 135, 130, 136, 128 ]" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Len: 40\n", + "Mean: 127.425\n", + "Median: 127.5\n" + ] + } + ], + "source": [ + "# Opgave A\n", + "print(f\"Len: {len(c)}\")\n", + "print(f\"Mean: {np.mean(c)}\")\n", + "print(f\"Median: {np.median(c)}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[<matplotlib.lines.Line2D at 0x7fa0b92dae80>]" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD4CAYAAADlwTGnAAAAOXRFWHRTb2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cD5qrozZlEqZi2ImTwf+Mx9nFJZVXWpqjZW1Raq2gLni6m9qn6dall3272B5eqN01UMqZn3JaArgIgcBeTijAjqT9ba+kU8WTfgXZzrCSwGznLnHQTMwtkbmAU09CnbMzi7oOU4/3GGVpYNZ1d7FbAC6JEieXu7j3cBG4HpqZC3gqzFOP2mi9zbuBTOOhXni2kJ8ArQNFWzxi1fi3sUkN9ZK/ls/w0sdT/bQiA/FfJWkDUX+I/7t/Ax0NXPrDYUhDHGZKm06wIyxhiTHFYAjDEmS1kBMMaYLGUFwBhjspQVAGOMyVJWAIwxJktZATDGmCz1f/XxseF8+OPGAAAAAElFTkSuQmCC\n", + "text/plain": [ + "<Figure size 432x288 with 1 Axes>" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "# Opgave B\n", + "sigma = np.std(c)\n", + "mean = np.mean(c)\n", + "\n", + "# Calculate a normal fitting\n", + "x = np.linspace(mean - 3*sigma, mean + 3 * sigma, 100)\n", + "\n", + "plt.hist(c, 20, density=True)\n", + "plt.plot(x, scipy.stats.norm.pdf(x, mean, sigma))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Stddiv: 11.723667301659493\n" + ] + } + ], + "source": [ + "# Opgave C\n", + "print(f\"Stddiv: {sigma}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percent in interval: 85.0%\n" + ] + } + ], + "source": [ + "# Opgave D\n", + "r = 1.5 * sigma\n", + "inside = ((c > (mean - r)) & (c < (mean + r))).sum()\n", + "percent = 100 * inside / len(c)\n", + "print(f\"Percent in interval: {percent}%\")" + ] + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "# Opgave F\n", + "This fits well with 85 between 68 and 95" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 2" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/sem6/prob/stat2/opgaver.tex b/sem6/prob/stat2/opgaver.tex new file mode 100644 index 0000000..0596cce --- /dev/null +++ b/sem6/prob/stat2/opgaver.tex @@ -0,0 +1,23 @@ +\title{Opgaver til Statistics Module 2} + +\section{Exercise 2} + +\subsection{Opgave A} + +Her kan vi sige at $y_i \sim \mathcal{N}(S', \sigma^2)$ hvor $S' = \alpha S$ og derfor er det at estimere $S'$ og isolere for $d$. + +Først kan vi estimere for $S'$, og eftersom $y_i$ er normal fordelt kan man estimere mean $S'$ med: \[ + \hat{\mu} = \sum_{i=1}^{n} \frac {x_i} n +.\] + +Nu kan vi isolere for $d$. +\begin{align*} + S' = \hat{\mu} = S \cdot \frac {0.5} d = \frac 1 n \sum_{i=1}^{n} x_i \\ + d = S \cdot \frac{0.5 n}{\sum_{i=1}^{n} x_i} +\end{align*} + +\section{Exercise 3} + +\subsection{Part 1} + +Okay jeg fortsætter på papir. diff --git a/sem6/prob/stat3/Untitled.ipynb b/sem6/prob/stat3/Untitled.ipynb new file mode 100644 index 0000000..b846ff4 --- /dev/null +++ b/sem6/prob/stat3/Untitled.ipynb @@ -0,0 +1,172 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "from scipy.stats import norm\n", + "from IPython.display import display, Math, Markdown\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Opgaver\n", + "\n", + "Har lavet problem 1 på papir, men vil lave resten i python da det nok er lidt lettere." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Problem 2\n", + "\n", + "Går ud fra at PCB er i ppm, og kalder den $\\theta$.\n", + "\n", + "$$\n", + "X_i = \\theta + W_i\n", + "$$\n", + "hvor $W_i \\sim \\mathcal{N}(\\mu, \\sigma^2)$, $\\sigma = 0.08$.\n", + "Her går jeg ud fra at $\\mu = 0$.\n", + "\n", + "Derfor er: \n", + "$$\n", + "E[X] = \\theta\n", + "$$\n", + "og\n", + "$$\n", + "Var[X] = (0.08)^2\n", + "$$\n", + "\n", + "Kan sige at confidence level er:\n", + "$$\n", + "[\\bar{X} - z_{\\frac \\alpha 2} \\cdot \\frac \\sigma {\\sqrt{n}}, \\bar{X} + z_{\\frac \\alpha 2} \\cdot \\frac \\sigma {\\sqrt{n}}]\n", + "$$\n", + "with probability $1-\\alpha$.\n", + "Her er \n", + "$$\n", + "z_p = \\Phi^{-1}(1 - p)$$" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "samples = [11.2, 12.4, 10.8, 11.6, 12.5, 10.1, \n", + " 11.0, 12.2, 12.4, 10.6]\n", + "n = len(samples)\n", + "\n", + "X_bar = np.mean(samples)\n", + "sigma = 0.08" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle P(11.430416397415636 \\leq \\theta \\leq 11.529583602584365) = 0.95$" + ], + "text/plain": [ + "<IPython.core.display.Math object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Del A\n", + "alpha = 0.05\n", + "Z = norm.ppf(1 - alpha/2)\n", + "\n", + "dist = Z * sigma / np.sqrt(n)\n", + "lower = X_bar - dist\n", + "upper = X_bar + dist\n", + "\n", + "display(Math(f\"P({lower} \\\\leq \\\\theta \\\\leq {upper}) = {1 - alpha}\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle [-\\infty, 11.529583602584365]$" + ], + "text/plain": [ + "<IPython.core.display.Math object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "# Okay så lower confidence level er åbenbart at man går fra -infty til upper limit\n", + "\n", + "display(Math(f\"[-\\\\infty, {upper}]\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle [11.430416397415636, \\infty]$" + ], + "text/plain": [ + "<IPython.core.display.Math object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Del C\n", + "# Og igen for uppwer\n", + "\n", + "display(Math(f\"[{lower}, \\\\infty]\"))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} |