Analyse o-ring damage of Space Shuttle Challenger using R
In my earlier post I carried out an analysis of the Space Shuttle Challenger disaster using Python’s statistical library, statsmodels. That blog post can be read here:- https://medium.com/@tracyrenee61/analyse-space-shuttle-challengers-o-ring-damage-using-python-and-statsmodels-b2fd4aad800a
In this post I intend to perform the same type of analysis, but in the R programming language. R is a programming language written specifically with statistics in mind, while Python is an all purpose language.
R has many statistical and graphical functions inbuilt into the programming language, while Python has to rely on importing libraries to achieve the same things that R can accomplish as a standalone language.
R has many practice datasets inbuilt into the language, while Python does not.
I was not able to find a suitable csv file to work with, so I hard coded the dataframe, oring, into the program, as seen below.
I used the attach() function to attach the dataframe to the program, thereby enabling me to reference the column names without first naming the dataframe:-
I used the linear model, lm(), to linearly regress the temp as the independent variable, and damage as the dependent variable.
I then used the summary() function to summarise the statistics of the linear regression. It is worth noting that the p-value is 0.0009677.
I used the inbuilt graphics package to visualise the data. The temperature falls along the X axis, while the damage falls along the y axis.
It can be seen from the plotted graph that the lower the temperature goes, the higher the o-ring failures.
I used R’s inbuilt coef() function to obtain the coefficient of the regression, which represents the difference in the predicted value of the response for each one unit change in a predictor variable, assuming all other predictor variables are held constant.
The Space Shuttle failed at 31 degrees, so I put a calculation in to reference this.
I also put in some other calculations from a Bayesian statistic course I am taking, which deals with frequentist statistics and Bayesian statistics, which the reader can endeavour to interpret:-
The Space Shuttle Challenger disaster occurred because it was too cold outside. The low temperature damaged the o-rings, which caused the disaster. The plotted graph statistically shows that lower temperatures will cause more damage to the spacecraft’s o-rings.
I have created a code review for this post, and it can be found here:- https://youtu.be/IwzBzXUQ8PI
