{ "cells": [ { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "\n", "# Risk Analysis of the Space Shuttle: Pre-Challenger Prediction of Failure\n", "\n", "*Marie-Gabrielle Dondon*\n", "\n", "*11/10/2018*\n", "\n", "*This is a SAS version based on the Rmd document of Arnaud Legrand available at [https://app-learninglab.inria.fr](https://applearninglab.inria.fr/gitlab/moocrr-session1/moocrr-reproducibility-study/blob/5e298cd5b653bcb31b6f9fedcb7f75e800c2dc98/src/R/challenger.Rmd) and the SAS program of Michael Friendly available at [https://dokumen.tips](https://dokumen.tips/documents/categorical-data-analysis-with-graphics.html) (cf. page 52).*\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "In this document we reperform some of the analysis provided in \n", "*Risk Analysis of the Space Shuttle: Pre-Challenger Prediction of Failure* by *Siddhartha R. Dalal, Edward B. Fowlkes, Bruce Hoadley* published in *Journal of the American Statistical Association*, Vol. 84, No. 408 (Dec., 1989), pp. 945-957 and available at http://www.jstor.org/stable/2290069. \n", "\n", "On the fourth page of this article, they indicate that the maximum likelihood estimates of the logistic regression using only temperature are: $\\hat{\\alpha}$ = **5.085** and $\\hat{\\beta}$ = **-0.1156** and their asymptotic standard errors are $s_{\\hat{\\alpha}}$ = **3.052** and $s_{\\hat{\\beta}}$ = **0.047**. The Goodness of fit indicated for this model was $G^2$ = **18.086** with **21** degrees of freedom. Our goal is to reproduce the computation behind these values." ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The DATA step below reads the data on the number of O-ring failures and temperature for the 23 flights forwhich information was available before the Challenger launch. Our interest here is in predicting the likelihood of failures at low temperatures." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SAS Connection established. Subprocess id is 3488\n", "\n" ] }, { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

NASA Space Shuttle O-Ring Failures

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.NASA

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
FlightDateCountTemperaturePressureMalfunction
104/12/81666500
211/12/81670501
303/22/82669500
511/11/82668500
604/04/83667500
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ods title;\n", "ods noproctitle;\n", "title \"NASA Space Shuttle O-Ring Failures\";\n", "\n", "data nasa;\n", " input Flight $ Date :mmddyy8. Count Temperature Pressure Malfunction;\n", " format Date mmddyy8.;\n", " cards;\n", "1 04/12/81 6 66 50 0\n", "2 11/12/81 6 70 50 1\n", "3 03/22/82 6 69 50 0\n", "5 11/11/82 6 68 50 0\n", "6 04/04/83 6 67 50 0\n", "7 06/18/82 6 72 50 0\n", "8 08/30/83 6 73 100 0\n", "9 11/28/83 6 70 100 0\n", "41B 02/03/84 6 57 200 1\n", "41C 04/06/84 6 63 200 1\n", "41D 08/30/84 6 70 200 1\n", "41G 10/05/84 6 78 200 0\n", "51A 11/08/84 6 67 200 0\n", "51C 01/24/85 6 53 200 2\n", "51D 04/12/85 6 67 200 0\n", "51B 04/29/85 6 75 200 0\n", "51G 06/17/85 6 70 200 0\n", "51F 07/29/85 6 81 200 0\n", "51I 08/27/85 6 76 200 0\n", "51J 10/03/85 6 79 200 0\n", "61A 10/30/85 6 75 200 2\n", "61B 11/26/85 6 76 200 0\n", "61C 01/12/86 6 58 200 1\n", ";\n", "run;\n", "\n", "data nasa;\n", " set nasa;\n", " label Malfunction = \"Number of O-ring failures\"\n", " Temperature = \"Temperature (deg F)\";\n", "run;\n", "\n", "proc print data=nasa (obs=5);\n", " id Flight;\n", "run;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let’s visually inspect how temperature affects malfunction:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "

La GPLOT Procédure

\r\n", "
\r\n", "

Plot of Freq_Malfunction by Temperature

\r\n", "
\r\n", "\r\n", "\r\n", "svgtitle\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Estimated Failure probability\r\n", "\r\n", "0.0\r\n", "0.2\r\n", "0.4\r\n", "0.6\r\n", "0.8\r\n", "1.0\r\n", "\r\n", "Temperature (deg F)\r\n", "50\r\n", "55\r\n", "60\r\n", "65\r\n", "70\r\n", "75\r\n", "80\r\n", "85\r\n", "NASA Space Shuttle O-Ring Failures\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Plot of Freq_Malfunction by Temperature\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data nasa;\n", " set nasa;\n", " Freq_Malfunction = Malfunction/Count;\n", "run;\n", "\n", "proc gplot data=nasa;\n", " plot Freq_Malfunction * Temperature / haxis=axis1 hminor=0\n", " vaxis=axis2 vminor=0;\n", " symbol1 v=dot i=none c=blue h=2;\n", " axis1 order=(50 to 85 by 5);\n", " axis2 order=(0 to 1 by 0.2) label=(angle=90 'Estimated Failure probability');\n", "run;\n", "quit;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "To obtain predicted probabilities for observations not in the original sample, create an additional data set which contains values for the independent variables in the extrapolation sample, and join these observations to the actual data set. The response variable (Malfunction) will be missing for the extrapolation sample.\n", "\n", "Obtain predicted values for 30-80 degrees" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

NASA Space Shuttle O-Ring Failures

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.NASA2

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
FlightDateCountTemperaturePressureMalfunctionFreq_Malfunction
104/12/816665000.00000
211/12/816705010.16667
303/22/826695000.00000
511/11/826685000.00000
604/04/836675000.00000
706/18/826725000.00000
808/30/8367310000.00000
911/28/8367010000.00000
41B02/03/8465720010.16667
41C04/06/8466320010.16667
41D08/30/8467020010.16667
41G10/05/8467820000.00000
51A11/08/8466720000.00000
51C01/24/8565320020.33333
51D04/12/8566720000.00000
51B04/29/8567520000.00000
51G06/17/8567020000.00000
51F07/29/8568120000.00000
51I08/27/8567620000.00000
51J10/03/8567920000.00000
61A10/30/8567520020.33333
61B11/26/8567620000.00000
61C01/12/8665820010.16667
 ..31...
 ..30...
 ..35...
 ..40...
 ..45...
 ..50...
 ..55...
 ..60...
 ..65...
 ..70...
 ..75...
 ..80...
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data temp;\n", " input Temperature @@;\n", " cards;\n", "31 30 35 40 45 50 55 60 65 70 75 80\n", ";\n", "run;\n", "\n", "data nasa2;\n", " set nasa temp;\n", "run;\n", "\n", "proc print data=nasa2;\n", " id Flight;\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "In the PROC LOGISTIC step, we use the events/trials syntax to indicate the number of failures and number of trials. The observations in the extrapolation sample are not used in fitting the model, yet the procedure produces predicted probabilities and logits (as long as the independent variable(s) are non-missing)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

NASA Space Shuttle O-Ring Failures

\r\n", "
\r\n", "

La LOGISTIC Procédure

\r\n", "
\r\n", "

Informations sur le modèle

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Informations sur le modèle
TableWORK.NASA2 
Variable de réponse (Evénements)MalfunctionNumber of O-ring failures
Variable de réponse (Expériences)Count 
Modèlelogit binaire 
Technique d'optimisationScore de Fisher 
\r\n", "
\r\n", "
\r\n", "

Synthèse des observations

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Nb d'observations lues35
Nb d'observations utilisées23
Somme des fréquences lues138
Somme des fréquences utilis138
\r\n", "
\r\n", "
\r\n", "

Profil de réponse

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Profil de réponse
Valeur
ordonnée
Résultat binaireFréquence
totale
1Evénemen9
2Non-évén129
\r\n", "
\r\n", "
\r\n", "

Note:12 observations were deleted due to missing values for the response or explanatory variables.

\r\n", "
\r\n", "
\r\n", "

Etat de convergence

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Etat de convergence du modèle
Critère de convergence (GCONV=1E-8) respecté.
\r\n", "
\r\n", "
\r\n", "

Qualité de l'ajustement

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Statistique d'adéquation de la déviance et de Pearson
CritèreValeurDDLValeur/DDLPr > Khi-2
Ecart18.0863210.86130.6435
Pearson29.9803211.42760.0924
\r\n", "
\r\n", "

Nombre d'observations d'événements/expériences : 23

\r\n", "
\r\n", "
\r\n", "
\r\n", "

Statistiques d'ajustement

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Statistiques d'ajustement du modèle
CritèreConstante uniquementConstante et covariables
Log-vraisemblanceLog-vraisemblance complète
AIC68.54064.39635.647
SC71.46870.25141.501
-2 Log66.54060.39631.647
\r\n", "
\r\n", "
\r\n", "

Tests globaux

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Test de l'hypothèse nulle globale : BETA=0
TestKhi-2DDLPr > Khi-2
Rapport de vrais6.144010.0132
Score6.769610.0093
Wald6.043510.0140
\r\n", "
\r\n", "
\r\n", "

Valeurs estimées du paramètre

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Estimations par l'analyse du maximum de vraisemblance
ParamètreDDLEstimationErreur
type
Khi-2
de Wald
Pr > Khi-2
Intercept15.08503.05252.77510.0957
Temperature1-0.11560.04706.04350.0140
\r\n", "
\r\n", "
\r\n", "

Rapports de cotes

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Estimations des rapports de cotes
EffetValeur estimée du point95% Intervalle de confiance
de Wald
Temperature0.8910.8120.977
\r\n", "
\r\n", "
\r\n", "

Statistiques d'association

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
Association des probabilités prédites et des réponses observées
Pourcentage concordant65.4D de Somers0.382
Pourcentage discordant27.1Gamma0.413
Pourcentage lié7.5Tau-a0.047
Paires1161c0.691
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ods output OddsRatios=OddsRatios ParameterEstimates=ParameterEstimates GoodnessOfFit=GoodnessOfFit;\n", "proc logistic data=nasa2 nosimple;\n", " model Malfunction/Count = Temperature / scale=none;\n", " output out=results p=predict l=lower u=upper;\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The printed output indicates that the 12 new observations were not used in the analysis." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

Odds Ratios

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.ODDSRATIOS

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
EffetEstimation du rapport de cotesBorne inférieure de l'IC à 95% pour le rapport de cotesBorne supérieure de l'IC à 95% pour le rapport de cotes
Temperature0.8910.8120.977
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "proc print data=OddsRatios label;\n", " id Effect;\n", " title \"Odds Ratios\";\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The odds ratio, 0.891, is interpreted to mean that each increase of 1° in temperature decreases the odds of a failure by 11%!" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

Parameter Estimates

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.PARAMETERESTIMATES

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
VariableDDLEstimationErreur typeKhi-2 de WaldPr > Khi-2
Intercept15.084983.052492.77510.0957
Temperature1-0.115600.047026.04350.0140
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "proc print data=ParameterEstimates label;\n", " id variable;\n", " format estimate stderr 8.5;\n", " var _numeric_;\n", " title \"Parameter Estimates\";\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The maximum likelyhood estimator of the intercept and of Temperature are thus $\\hat{\\alpha}$ = **5.0850** and $\\hat{\\beta}$ = **-0.1156** and their standard errors are $s_{\\hat{\\alpha}}$ = **3.052** and $s_{\\hat{\\beta}}$ = **0.04702**." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

Goodness Of Fit

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.GOODNESSOFFIT

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
CritèreDDLKhi-2Khi-2/DDLPr > Khi-2
Ecart2118.08630.86130.6435
Pearson2129.98031.42760.0924
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "proc print data=GoodnessOfFit label;\n", " id criterion;\n", " title \"Goodness Of Fit\";\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The Residual deviance corresponds to the Goodness of fit $G^2$ = **18.086** with **21** degrees of freedom." ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "The output data set results contains the predicted probability of a failure at each temperature and upper and\n", "lower confidence 95% limits for this probability." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "
\r\n", "

Predicted probabilities of a failure

\r\n", "
\r\n", "

La PRINT Procédure

\r\n", "
\r\n", "

Table WORK.RESULTS

\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
FlightDateCountTemperaturePressureMalfunctionFreq_Malfunctionpredictlowerupper
104/12/816665000.000000.072780.037160.13767
211/12/816705010.166670.047110.020440.10482
303/22/826695000.000000.052580.024060.11104
511/11/826685000.000000.058640.028090.11837
604/04/836675000.000000.065360.032480.12713
706/18/826725000.000000.037750.014470.09485
808/30/8367310000.000000.033770.012090.09077
911/28/8367010000.000000.047110.020440.10482
41B02/03/8465720010.166670.181790.077030.37163
41C04/06/8466320010.166670.099940.051820.18408
41D08/30/8467020010.166670.047110.020440.10482
41G10/05/8467820000.000000.019230.004680.07557
51A11/08/8466720000.000000.065360.032480.12713
51C01/24/8565320020.333330.260790.090490.55575
51D04/12/8566720000.000000.065360.032480.12713
51B04/29/8567520000.000000.026990.008330.08385
51G06/17/8567020000.000000.047110.020440.10482
51F07/29/8568120000.000000.013670.002590.06887
51I08/27/8567620000.000000.024110.006890.08086
51J10/03/8567920000.000000.017170.003850.07319
61A10/30/8567520020.333330.026990.008330.08385
61B11/26/8567620000.000000.024110.006890.08086
61C01/12/8665820010.166670.165220.073340.33107
 ..31...0.817770.159600.99066
 ..30...0.834370.163070.99238
 ..35...0.738640.146150.97902
 ..40...0.613230.130160.94382
 ..45...0.470760.114870.85910
 ..50...0.332900.099790.69198
 ..55...0.218730.083980.46092
 ..60...0.135740.065380.26070
 ..65...0.080980.042020.15038
 ..70...0.047110.020440.10482
 ..75...0.026990.008330.08385
 ..80...0.015320.003160.07097
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "proc print data=results;\n", " id Flight;\n", " title \"Predicted probabilities of a failure\";\n", "run;" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "We can plot the predicted and observed values as shown below. A vertical reference line at 31° is used to highlight the conditions at the Challenger launch.\n", "\n", "The graph is shown in Figure below. There’s not much data at low temperatures (the confidence band is quite\n", "wide), but the predicted probability of failure is uncomfortably high. Would you take a ride on Challenger when\n", "the weather is cold?" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Sortie SAS\r\n", "\r\n", "\r\n", "\r\n", "

Sortie SAS

\r\n", "
\r\n", "

La GPLOT Procédure

\r\n", "
\r\n", "

Plot of obs by Temperature

\r\n", "
\r\n", "\r\n", "\r\n", "svgtitle\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Estimated Failure probability\r\n", "\r\n", "0.0\r\n", "0.1\r\n", "0.2\r\n", "0.3\r\n", "0.4\r\n", "0.5\r\n", "0.6\r\n", "0.7\r\n", "0.8\r\n", "0.9\r\n", "1.0\r\n", "\r\n", "\r\n", "Temperature (deg F)\r\n", "30\r\n", "40\r\n", "50\r\n", "60\r\n", "70\r\n", "80\r\n", "90\r\n", "Predicted probabilities of a failure\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Plot of obs by Temperature\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "
\r\n", "
\r\n", "
\r\n", "\r\n", "\r\n" ], "text/plain": [ "" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "proc sort data=results;\n", " by predict;\n", "run;\n", "\n", "data results;\n", " set results;\n", " obs = Malfunction / Count;\n", "run;\n", "\n", "proc gplot data=results;\n", " plot (obs predict lower upper) * Temperature /\n", " href=31 lhref=33\n", " overlay frame vaxis=axis1 vminor=1;\n", " symbol1 v=dot i=none c=blue h=2;\n", " symbol2 v=none i=spline c=black w=5;\n", " symbol3 v=none i=spline c=red l=33 r=2 w=3;\n", " axis1 label=(a=90 \"Estimated Failure probability\") offset=(3);\n", "run;" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "hide_code_all_hidden": true, "kernelspec": { "display_name": "SAS", "language": "sas", "name": "sas" }, "language_info": { "codemirror_mode": "sas", "file_extension": ".sas", "mimetype": "text/x-sas", "name": "sas" } }, "nbformat": 4, "nbformat_minor": 2 }