diff --git a/module2/exo5/exo_02_5.ipynb b/module2/exo5/exo_02_5.ipynb
new file mode 100644
index 0000000000000000000000000000000000000000..8aa5a29784da4cf93eefdf0056deb404423cd39f
--- /dev/null
+++ b/module2/exo5/exo_02_5.ipynb
@@ -0,0 +1,714 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Analysis of the risk of failure of the O-rings on the Challenger shuttle"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "On January 27, 1986, the day before the takeoff of the shuttle _Challenger_, had\n",
+ "a three-hour teleconference was held between \n",
+ "Morton Thiokol (the manufacturer of one of the engines) and NASA. The\n",
+ "discussion focused on the consequences of the\n",
+ "temperature at take-off of 31°F (just below\n",
+ "0°C) for the success of the flight and in particular on the performance of the\n",
+ "O-rings used in the engines. Indeed, no test\n",
+ "had been performed at this temperature.\n",
+ "\n",
+ "The following study takes up some of the analyses carried out that\n",
+ "night with the objective of assessing the potential influence of\n",
+ "the temperature and pressure to which the O-rings are subjected\n",
+ "on their probability of malfunction. Our starting point is \n",
+ "the results of the experiments carried out by NASA engineers\n",
+ "during the six years preceding the launch of the shuttle\n",
+ "Challenger."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Loading the data\n",
+ "We start by loading this data:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
Date
\n",
+ "
Count
\n",
+ "
Temperature
\n",
+ "
Pressure
\n",
+ "
Malfunction
\n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
0
\n",
+ "
4/12/81
\n",
+ "
6
\n",
+ "
66
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
1
\n",
+ "
11/12/81
\n",
+ "
6
\n",
+ "
70
\n",
+ "
50
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
2
\n",
+ "
3/22/82
\n",
+ "
6
\n",
+ "
69
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
3
\n",
+ "
11/11/82
\n",
+ "
6
\n",
+ "
68
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
4
\n",
+ "
4/04/83
\n",
+ "
6
\n",
+ "
67
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
5
\n",
+ "
6/18/82
\n",
+ "
6
\n",
+ "
72
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
6
\n",
+ "
8/30/83
\n",
+ "
6
\n",
+ "
73
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
7
\n",
+ "
11/28/83
\n",
+ "
6
\n",
+ "
70
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
8
\n",
+ "
2/03/84
\n",
+ "
6
\n",
+ "
57
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
9
\n",
+ "
4/06/84
\n",
+ "
6
\n",
+ "
63
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
10
\n",
+ "
8/30/84
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
11
\n",
+ "
10/05/84
\n",
+ "
6
\n",
+ "
78
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
12
\n",
+ "
11/08/84
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
13
\n",
+ "
1/24/85
\n",
+ "
6
\n",
+ "
53
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
14
\n",
+ "
4/12/85
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
15
\n",
+ "
4/29/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
16
\n",
+ "
6/17/85
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
17
\n",
+ "
7/29/85
\n",
+ "
6
\n",
+ "
81
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
18
\n",
+ "
8/27/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
19
\n",
+ "
10/03/85
\n",
+ "
6
\n",
+ "
79
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
20
\n",
+ "
10/30/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
21
\n",
+ "
11/26/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
22
\n",
+ "
1/12/86
\n",
+ "
6
\n",
+ "
58
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Date Count Temperature Pressure Malfunction\n",
+ "0 4/12/81 6 66 50 0\n",
+ "1 11/12/81 6 70 50 1\n",
+ "2 3/22/82 6 69 50 0\n",
+ "3 11/11/82 6 68 50 0\n",
+ "4 4/04/83 6 67 50 0\n",
+ "5 6/18/82 6 72 50 0\n",
+ "6 8/30/83 6 73 100 0\n",
+ "7 11/28/83 6 70 100 0\n",
+ "8 2/03/84 6 57 200 1\n",
+ "9 4/06/84 6 63 200 1\n",
+ "10 8/30/84 6 70 200 1\n",
+ "11 10/05/84 6 78 200 0\n",
+ "12 11/08/84 6 67 200 0\n",
+ "13 1/24/85 6 53 200 2\n",
+ "14 4/12/85 6 67 200 0\n",
+ "15 4/29/85 6 75 200 0\n",
+ "16 6/17/85 6 70 200 0\n",
+ "17 7/29/85 6 81 200 0\n",
+ "18 8/27/85 6 76 200 0\n",
+ "19 10/03/85 6 79 200 0\n",
+ "20 10/30/85 6 75 200 2\n",
+ "21 11/26/85 6 76 200 0\n",
+ "22 1/12/86 6 58 200 1"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "data"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The data set shows us the date of each test, the number of O-rings (there are 6 on the main launcher), the temperature (in Fahrenheit) and pressure (in psi), and finally the number of identified malfunctions."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Graphical inspection\n",
+ "Flights without incidents do not provide any information\n",
+ "on the influence of temperature or pressure on malfunction.\n",
+ "We thus focus on the experiments in which at least one O-ring\n",
+ "was defective."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "pd.set_option('mode.chained_assignment',None) # this removes a useless warning from pandas\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "data[\"Frequency\"]=data.Malfunction/data.Count\n",
+ "data.plot(x=\"Temperature\",y=\"Frequency\",kind=\"scatter\",ylim=[0,1])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "At first glance, the dependence does not look very important, but let's try to\n",
+ "estimate the impact of temperature $t$ on the probability of O-ring malfunction."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation of the temperature influence\n",
+ "\n",
+ "Suppose that each of the six O-rings is damaged with the same\n",
+ "probability and independently of the others and that this probability\n",
+ "depends only on the temperature. If $p(t)$ is this probability, the\n",
+ "number $D$ of malfunctioning O-rings during a flight at\n",
+ "temperature $t$ follows a binomial law with parameters $n=6$ and\n",
+ "$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a\n",
+ "logistic regression."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
Generalized Linear Model Regression Results
\n",
+ "
\n",
+ "
Dep. Variable:
Frequency
No. Observations:
7
\n",
+ "
\n",
+ "
\n",
+ "
Model:
GLM
Df Residuals:
5
\n",
+ "
\n",
+ "
\n",
+ "
Model Family:
Binomial
Df Model:
1
\n",
+ "
\n",
+ "
\n",
+ "
Link Function:
logit
Scale:
1.0000
\n",
+ "
\n",
+ "
\n",
+ "
Method:
IRLS
Log-Likelihood:
-2.5250
\n",
+ "
\n",
+ "
\n",
+ "
Date:
Fri, 13 Jun 2025
Deviance:
0.22231
\n",
+ "
\n",
+ "
\n",
+ "
Time:
14:15:51
Pearson chi2:
0.236
\n",
+ "
\n",
+ "
\n",
+ "
No. Iterations:
4
Covariance Type:
nonrobust
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
coef
std err
z
P>|z|
[0.025
0.975]
\n",
+ "
\n",
+ "
\n",
+ "
Intercept
-1.3895
7.828
-0.178
0.859
-16.732
13.953
\n",
+ "
\n",
+ "
\n",
+ "
Temperature
0.0014
0.122
0.012
0.991
-0.238
0.240
\n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "\"\"\"\n",
+ " Generalized Linear Model Regression Results \n",
+ "==============================================================================\n",
+ "Dep. Variable: Frequency No. Observations: 7\n",
+ "Model: GLM Df Residuals: 5\n",
+ "Model Family: Binomial Df Model: 1\n",
+ "Link Function: logit Scale: 1.0000\n",
+ "Method: IRLS Log-Likelihood: -2.5250\n",
+ "Date: Fri, 13 Jun 2025 Deviance: 0.22231\n",
+ "Time: 14:15:51 Pearson chi2: 0.236\n",
+ "No. Iterations: 4 Covariance Type: nonrobust\n",
+ "===============================================================================\n",
+ " coef std err z P>|z| [0.025 0.975]\n",
+ "-------------------------------------------------------------------------------\n",
+ "Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953\n",
+ "Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240\n",
+ "===============================================================================\n",
+ "\"\"\""
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "\n",
+ "data[\"Success\"]=data.Count-data.Malfunction\n",
+ "data[\"Intercept\"]=1\n",
+ "\n",
+ "logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()\n",
+ "\n",
+ "logmodel.summary()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The most likely estimator of the temperature parameter is 0.0014\n",
+ "and the standard error of this estimator is 0.122, in other words we\n",
+ "cannot distinguish any particular impact and we must take our\n",
+ "estimates with caution."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation of the probability of O-ring malfunction\n",
+ "\n",
+ "The expected temperature on the take-off day is 31°F. Let's try to\n",
+ "estimate the probability of O-ring malfunction at\n",
+ "this temperature from the model we just built:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEKCAYAAADpfBXhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RV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ZMbrrpJqKzxKG5uZmLL76YWbNmUVdXx4kTJ1iyZEnGi9LChQvZtWtXQX8Pn8yXNBEpqO8/u4e9rccL2ud5k87mziv/5LRt2tvbmT17NgDTpk3jqaeeAuDll19m165djBs3jq1bt3Lw4EFeffVV3J2rrrqKF198kVGjRtHY2MiOHTvo6Ohg7ty5zJs377T7e+ihhxgzZgzNzc189NFHLFy4MPUCsmPHDvbs2cOkSZNYuHAhL730EnV1dSxbtozHHnuM+fPnc/z4caqqqrjlllvYuHEja9eu5cCBA3z00UdccMEFBfitdVO4i0jZ6mta5vLLL2fcuHEAbN26la1btzJnzhwA2traOHjwICdOnODaa69l5MiRAFx11VX97m/r1q3s2rWLJ554AoD333+fgwcPMnz4cOrq6qipqQFg9uzZHD58mDFjxjBx4kTmz58PwNlnnw3Atddey8KFC2loaGDDhg18/etfP7NfRC8U7iJyxvo7wh5qo0aNSt12d9asWcM3vvGNjDZr167t83TDyspKurq6ADLONXd3fvjDH7JkyZKM9k1NTZx11lmp5UQiQUdHB+7e6z5GjhzJ5ZdfztNPP83jjz9OvlfIPR3NuYtI0JYsWcKGDRtoa2sD4MiRIxw9epRLLrmEp556ivb2dk6cOMGzzz6b2mbq1Kls374dIHWUnuzr/vvv59SpUwAcOHCADz74oM99z5w5k9bWVpqbm4Hok6kdHR0ArFixgm9/+9vMnz8/9VdGIenIXUSCtnjxYvbt28dFF10EQHV1NQ8//DBz585l2bJlzJ49m89+9rN88YtfTG1z++2389WvfpWf/OQnXHrppan1K1as4PDhw8ydOxd359xzz2XTpk197nv48OE89thjfOtb36K9vZ2qqiqef/55AObNm8fZZ5/NrbcO0rUW3b0oP/PmzfN8/fznP89721KjWkpTKLUMZh179+4dtL57c/z48UHt/8477/SGhoZB3UfS8ePH/ciRIz59+nTv7Ozss11vv2Ngm+eQsZqWEREZYo888ggLFizgnnvuGbSvDtS0jIgIcNdddw3Zvm688cYeb/AWmo7cRSRv7r1+XbIUwJn+bhXuIpKXESNG8O677yrgB4HH13Mf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taZ+svtDMno9v321mD5jZc0QXK6s0s/8e73uXma0Y+t+qhEjhLmUjvmDctcDF8YXkKoku5QAwBtgaX8zsY+Auoo+tXw/8dVo3dfE2c4EbzWx2Dv2+5u517v4y8AN3nw+cH9+31N0fA3YCyzy6nnp/00ZzgCvd/WZgJdEF5eqA+UQXYftMPr8fkXSac5dychlRAG6LLjlCFdFH7QHa3f25+PZuosvEdpjZbmBqWh9b3P1fAMxsE/AFoudBX/1+TPelFgC+ZGargRHAOcB24H8PsI6n3f1kfHsx8K/MLP3FZDrRR9JF8qZwl3JiwAZ3/6uMlWaVRCGc1EX0DV7J2+n/z7PfZPJ++m33+I2p+Lot/wOY6+5HzOxuopDvTQfdfxlnt/kgq6a/cPcXECkgTctIOXke+KqZnQPRWTV5TGEstug7U0cSXTP8pQH0W0X0YnEsvirmv0m77wQwOm35MNFX3ZHVLtsW4C/iF5Lk96BWDbAmkR505C5lw913x1cLfN7MKoiusncb0DqAbn4JPAL8MfCT5NktufTr7u+a2T8QXd74N8Cv0u7+e+BBM2snmte/C/g7M/sd8OppxvMA0ZUBd8ZTQkeJXnREzohOhZRPjPhMlM+7+3eKPRaRwaZpGRGRAOnIXUQkQDpyFxEJkMJdRCRACncRkQAp3EVEAqRwFxEJ0P8HfLcy7/zjy3oAAAAASUVORK5CYII=\n",
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "data_pred = pd.DataFrame({'Temperature': np.linspace(start=30, stop=90, num=121), 'Intercept': 1})\n",
+ "data_pred['Frequency'] = logmodel.predict(data_pred[['Intercept','Temperature']])\n",
+ "data_pred.plot(x=\"Temperature\",y=\"Frequency\",kind=\"line\",ylim=[0,1])\n",
+ "plt.scatter(x=data[\"Temperature\"],y=data[\"Frequency\"])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "hideCode": false,
+ "hidePrompt": false,
+ "scrolled": true
+ },
+ "source": [
+ "As expected from the initial data, the\n",
+ "temperature has no significant impact on the probability of failure of the\n",
+ "O-rings. It will be about 0.2, as in the tests\n",
+ "where we had a failure of at least one joint. Let's get back\n",
+ "to the initial dataset to estimate the probability of failure:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.06521739130434782\n"
+ ]
+ }
+ ],
+ "source": [
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "print(np.sum(data.Malfunction)/np.sum(data.Count))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "This probability is thus about $p=0.065$. Knowing that there is\n",
+ "a primary and a secondary O-ring on each of the three parts of the\n",
+ "launcher, the probability of failure of both joints of a launcher\n",
+ "is $p^2 \\approx 0.00425$. The probability of failure of any one of the\n",
+ "launchers is $1-(1-p^2)^3 \\approx 1.2%$. That would really be\n",
+ "bad luck.... Everything is under control, so the takeoff can happen\n",
+ "tomorrow as planned.\n",
+ "\n",
+ "But the next day, the Challenger shuttle exploded and took away\n",
+ "with her the seven crew members. The public was shocked and in\n",
+ "the subsequent investigation, the reliability of the\n",
+ "O-rings was questioned. Beyond the internal communication problems\n",
+ "of NASA, which have a lot to do with this fiasco, the previous analysis\n",
+ "includes (at least) a small problem.... Can you find it?\n",
+ "You are free to modify this analysis and to look at this dataset\n",
+ "from all angles in order to to explain what's wrong."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "celltoolbar": "Hide code",
+ "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.6.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}