Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
victormg
mooc-rr
Commits
45b8372b
Commit
45b8372b
authored
Apr 29, 2020
by
Victor-M-Gomes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module2 exo5
parent
6509bb73
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
609 additions
and
53 deletions
+609
-53
exo5_python_en.html
module2/exo5/exo5_python_en.html
+528
-0
exo5_python_en.org
module2/exo5/exo5_python_en.org
+81
-53
freq_temp_python.png
module2/exo5/freq_temp_python.png
+0
-0
proba_estimate_python.png
module2/exo5/proba_estimate_python.png
+0
-0
No files found.
module2/exo5/exo5_python_en.html
0 → 100644
View file @
45b8372b
This diff is collapsed.
Click to expand it.
module2/exo5/exo5_python_en.org
View file @
45b8372b
...
...
@@ -14,12 +14,12 @@
# #+PROPERTY: header-args :session :exports both
On January 27, 1986, the day before the takeoff of the shuttle /Challenger/,
had
On January 27, 1986, the day before the takeoff of the shuttle /Challenger/,
a three-hour teleconference was held between
Morton Thiokol (the manufacturer of one of the engines) and NASA. The
discussion focused on the consequences of
the
temperature at take-off of 31°F (just below
0°C) for the success of the flight and in particular
on the performance of the
discussion focused on the consequences of
a 31°F (just below
0°C) temperature, at take-off, in the success of the flight and in particular
on the performance of the
O-rings used in the engines. Indeed, no test
had been performed at this temperature.
...
...
@@ -79,19 +79,37 @@ on the influence of temperature or pressure on malfunction.
We thus focus on the experiments in which at least one O-ring was defective.
#+begin_src python :results value :session *python* :exports both
data = data[data.Malfunction>0]
#
data = data[data.Malfunction>0]
data
#+end_src
#+RESULTS:
: Date Count Temperature Pressure Malfunction
: 1 11/12/81 6 70 50 1
: 8 2/03/84 6 57 200 1
: 9 4/06/84 6 63 200 1
: 10 8/30/84 6 70 200 1
: 13 1/24/85 6 53 200 2
: 20 10/30/85 6 75 200 2
: 22 1/12/86 6 58 200 1
#+begin_example
Date Count Temperature Pressure Malfunction
0 4/12/81 6 66 50 0
1 11/12/81 6 70 50 1
2 3/22/82 6 69 50 0
3 11/11/82 6 68 50 0
4 4/04/83 6 67 50 0
5 6/18/82 6 72 50 0
6 8/30/83 6 73 100 0
7 11/28/83 6 70 100 0
8 2/03/84 6 57 200 1
9 4/06/84 6 63 200 1
10 8/30/84 6 70 200 1
11 10/05/84 6 78 200 0
12 11/08/84 6 67 200 0
13 1/24/85 6 53 200 2
14 4/12/85 6 67 200 0
15 4/29/85 6 75 200 0
16 6/17/85 6 70 200 0
17 7/29/85 6 81 200 0
18 8/27/85 6 76 200 0
19 10/03/85 6 79 200 0
20 10/30/85 6 75 200 2
21 11/26/85 6 76 200 0
22 1/12/86 6 58 200 1
#+end_example
We have a high temperature variability but
the pressure is almost always 200, which should
...
...
@@ -133,29 +151,31 @@ data["Success"]=data.Count-data.Malfunction
data["Intercept"]=1
#
logit_model=sm.Logit(data["Frequency"],data[["Intercept","Temperature"]]).fit()
#
logit_model=sm.Logit(data['Frequency'],data[['Intercept','Temperature']]).fit()
logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()
logmodel.summary()
#logit_model.summary()
#+end_src
#+RESULTS:
#+begin_example
Generalized Linear Model Regression Results
==============================================================================
Dep. Variable:
Frequency No. Observations: 7
Model:
GLM Df Residuals: 5
==============================================================================
=
Dep. Variable:
Frequency No. Observations: 23
Model:
GLM Df Residuals: 21
Model Family: Binomial Df Model: 1
Link Function: logit Scale: 1.0
Method: IRLS Log-Likelihood: -3.6370
Date: Fri, 20 Jul 2018 Deviance: 3.3763
Time: 16:56:08 Pearson chi2: 0.236
No. Iterations: 5
Link Function: logit Scale: 1.0000
Method: IRLS Log-Likelihood: -3.9210
Date: mer., 29 avril 2020 Deviance: 3.0144
Time: 20:57:18 Pearson chi2: 5.00
No. Iterations: 6
Covariance Type: nonrobust
===============================================================================
coef std err z P>|z| [0.025 0.975]
-------------------------------------------------------------------------------
Intercept
-1.3895 7.828 -0.178 0.859 -16.732 13.953
Temperature
0.0014 0.122 0.012 0.991 -0.238 0.24
0
Intercept
5.0850 7.477 0.680 0.496 -9.570 19.740
Temperature
-0.1156 0.115 -1.004 0.316 -0.341 0.11
0
===============================================================================
#+end_example
...
...
@@ -185,6 +205,7 @@ print(matplot_lib_filename)
#+RESULTS:
[[file:proba_estimate_python.png]]
As expected from the initial data, the
temperature has no significant impact on the probability of failure of the
O-rings. It will be about 0.2, as in the tests
...
...
@@ -193,10 +214,18 @@ where we had a failure of at least one joint. Let's get back to the initial data
#+begin_src python :results output :session *python* :exports both
data = pd.read_csv("shuttle.csv")
print(np.sum(data.Malfunction)/np.sum(data.Count))
print(np.sum(data.Count))
pfailure = np.sum(data.Malfunction)/23
print(1-(1-0.39**2)**3)
#+end_src
#+RESULTS:
: 0.06521739130434782
: 138
: Probability of failure 0.391304347826087
: Probability failure both joints: 0.15311909262759926
: 0.010869565217391304
: 0.39041551376100003
This probability is thus about $p=0.065$. Knowing that there is
a primary and a secondary O-ring on each of the three parts of the
...
...
@@ -213,5 +242,4 @@ O-rings was questioned. Beyond the internal communication problems
of NASA, which have a lot to do with this fiasco, the previous analysis
includes (at least) a small problem.... Can you find it?
You are free to modify this analysis and to look at this dataset
from all angles in order to to explain what's wrong.
from all angles in order to explain what's wrong.
module2/exo5/freq_temp_python.png
View replaced file @
6509bb73
View file @
45b8372b
12.3 KB
|
W:
|
H:
13 KB
|
W:
|
H:
2-up
Swipe
Onion skin
module2/exo5/proba_estimate_python.png
View replaced file @
6509bb73
View file @
45b8372b
14.3 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment