Exercise on descriptive statistics

This notebook is an element of the free risk-engineering.org courseware. It can be distributed under the terms of the Creative Commons Attribution-ShareAlike licence.

Author: Eric Marsden eric.marsden@risk-engineering.org.


This notebook contains an application exercise on the use of Python and the NumPy library for simple descriptive statistics.

In [1]:
import numpy
import matplotlib.pyplot as plt

We will start by examining some data on fatigue life of strips of aluminium sheeting. The data is expressed in thousands of cycles until rupture. It compes from the article Birnbaum, Z. W. and Saunders, S. C. (1958), A statistical model for life-length of materials, Journal of the American Statistical Association, 53(281).

In [2]:
cycles = numpy.array([370, 1016, 1235, 1419, 1567, 1820, 706, 1018, 1238, 1420,
                          1578, 1868, 716, 1020, 1252, 1420, 1594, 1881, 746,
                          1055, 1258, 1450, 1602, 1890, 785, 1085, 1262, 1452,
                          1604, 1893, 797, 1102, 1269, 1475, 1608, 1895, 844,
                          1102, 1270, 1478, 1630, 1910, 855, 1108, 1290, 1481,
                          1642, 1923, 858, 1115, 1293, 1485, 1674, 1940, 886,
                          1120, 1300, 1502, 1730, 1945, 886, 1134, 1310, 1505,
                          1750, 2023, 930, 1140, 1313, 1513, 1750, 2100, 960,
                          1199, 1315, 1522, 1763, 2130, 988, 1200, 1330, 1522,
                          1768, 2215, 990, 1200, 1355, 1530, 1781, 2268, 1000,
                          1203, 1390, 1540, 1782, 2440, 1010, 1222, 1416, 1560,
                          1792])

Q: how many measurements of fatigue life do we have?

In [3]:
# type the expression for calculating the answer here

Q: what is the average (mean) number of cycles until rupture?

In [4]:
# type your answer here

Q: what is the median number of cycles until rupture?

In [5]:
# type your answer here

Q: What are the standard deviation and variance of the number of cycles until rupture?

In [ ]:
 
In [ ]:
 

Q: Plot a histogram of the distribution of cycles until failure. Label the x axis with "Cycles until failure".

In [6]:
# a histogram

Q: Now plot a box and whisper (boxplot) of the same data.

In [7]:
# now plot a box and whisker plot. Note that there is an outlier point (the circle)
In [ ]: