Commit 215b9255 authored by Jamal KHAN's avatar Jamal KHAN

Module 2 Exercise 5

parent 53396f25
...@@ -74,28 +74,43 @@ temperature (in Fahrenheit) and pressure (in psi), and finally the ...@@ -74,28 +74,43 @@ temperature (in Fahrenheit) and pressure (in psi), and finally the
number of identified malfunctions. number of identified malfunctions.
* Graphical inspection * Graphical inspection
Flights without incidents do not provide any information Flights without incidents do not provide any information on the influence of temperature or pressure on malfunction. We thus focus on the experiments in which at least one O-ring was defective.
on the influence of temperature or pressure on malfunction.
We thus focus on the experiments in which at least one O-ring was defective.
(Note: this approximation is not correct, as flights without incidents does provide information regarding the failure probability).
#+begin_src python :results value :session *python* :exports both #+begin_src python :results value :session *python* :exports both
data = data[data.Malfunction>0] #data = data[data.Malfunction>0]
data data
#+end_src #+end_src
#+RESULTS: #+RESULTS:
: Date Count Temperature Pressure Malfunction #+begin_example
: 1 11/12/81 6 70 50 1 Date Count Temperature Pressure Malfunction
: 8 2/03/84 6 57 200 1 0 4/12/81 6 66 50 0
: 9 4/06/84 6 63 200 1 1 11/12/81 6 70 50 1
: 10 8/30/84 6 70 200 1 2 3/22/82 6 69 50 0
: 13 1/24/85 6 53 200 2 3 11/11/82 6 68 50 0
: 20 10/30/85 6 75 200 2 4 4/04/83 6 67 50 0
: 22 1/12/86 6 58 200 1 5 6/18/82 6 72 50 0
6 8/30/83 6 73 100 0
We have a high temperature variability but 7 11/28/83 6 70 100 0
the pressure is almost always 200, which should 8 2/03/84 6 57 200 1
simplify the analysis. 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 simplify the analysis.
How does the frequency of failure vary with temperature? How does the frequency of failure vary with temperature?
#+begin_src python :results output file :var matplot_lib_filename="freq_temp_python.png" :exports both :session *python* #+begin_src python :results output file :var matplot_lib_filename="freq_temp_python.png" :exports both :session *python*
...@@ -142,20 +157,21 @@ logmodel.summary() ...@@ -142,20 +157,21 @@ logmodel.summary()
#+RESULTS: #+RESULTS:
#+begin_example #+begin_example
Generalized Linear Model Regression Results Generalized Linear Model Regression Results
============================================================================== ===============================================================================
Dep. Variable: Frequency No. Observations: 7 Dep. Variable: Frequency No. Observations: 23
Model: GLM Df Residuals: 5 Model: GLM Df Residuals: 21
Model Family: Binomial Df Model: 1 Model Family: Binomial Df Model: 1
Link Function: logit Scale: 1.0 Link Function: logit Scale: 1.0000
Method: IRLS Log-Likelihood: -3.6370 Method: IRLS Log-Likelihood: -3.9210
Date: Fri, 20 Jul 2018 Deviance: 3.3763 Date: mer., 16 sept. 2020 Deviance: 3.0144
Time: 16:56:08 Pearson chi2: 0.236 Time: 00:01:54 Pearson chi2: 5.00
No. Iterations: 5 No. Iterations: 6
Covariance Type: nonrobust
=============================================================================== ===============================================================================
coef std err z P>|z| [0.025 0.975] coef std err z P>|z| [0.025 0.975]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953 Intercept 5.0850 7.477 0.680 0.496 -9.570 19.740
Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240 Temperature -0.1156 0.115 -1.004 0.316 -0.341 0.110
=============================================================================== ===============================================================================
#+end_example #+end_example
......
module2/exo5/freq_temp_python.png

12.3 KB | W: | H:

module2/exo5/freq_temp_python.png

12.7 KB | W: | H:

module2/exo5/freq_temp_python.png
module2/exo5/freq_temp_python.png
module2/exo5/freq_temp_python.png
module2/exo5/freq_temp_python.png
  • 2-up
  • Swipe
  • Onion skin
module2/exo5/proba_estimate_python.png

14.3 KB | W: | H:

module2/exo5/proba_estimate_python.png

21.9 KB | W: | H:

module2/exo5/proba_estimate_python.png
module2/exo5/proba_estimate_python.png
module2/exo5/proba_estimate_python.png
module2/exo5/proba_estimate_python.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment