{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction to mathematical statistics \n", "\n", "Welcome to lecture 3 in 02403\n", "\n", "During the lectures we will present both slides and notebooks. \n", "\n" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import scipy.stats as stats" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example: June 2024" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.6065306597126334\n", "0.6065306597126334\n" ] } ], "source": [ "lambda2min = 15/60\n", "print(1 - stats.expon.cdf(2, loc = 0, scale = 1 / lambda2min))\n", "print(1 - stats.expon.cdf(2/60, loc = 0, scale = 1 / 15))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example: Air plane" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(0.02155722339153765)" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mu = 70 * 55\n", "sigma = np.sqrt(55 * 100)\n", "1 - stats.norm.cdf(4000, mu, sigma)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "or a quick estimate" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(2.0225995873897262)" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(4000 - mu)/sigma" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: Standard scale" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "a)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(0.022750131948179195)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.norm.cdf(-2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "b)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(0.02275013194817921)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "1-stats.norm.cdf(2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "c)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(0.6826894921370859)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.norm.cdf(1)-stats.norm.cdf(-1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "d)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(1.959963984540054)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.norm.ppf(0.975)" ] } ], "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.10.16" } }, "nbformat": 4, "nbformat_minor": 2 }