We have a dataset of 20 data, concrete strength.
We want to develop simple data analysis, including:
statistics of the samples
histograms
empirical cdf
----------------------------------
import numpy as np import matplotlib.pyplot as plt import OpenStat as sta
#===================
DATA SUMMARY
#===================
data=np.loadtxt('concrete20.dat') d=sta.data1(data)
#d is the object collecting the dataset
data=d.data d.disp_summary()
#===================
#===================
edges=[23, 26, 29, 32, 35, 38, 41] edges=np.array(edges)
#Number of observations d.plot_hist(bins=edges,stat='count')
#bins=edges: limits of the bins #stat='count': number of observations at each bin #color='blue': color of the bars d.ax.set_xlim(23,41) d.ax.set_xticks(edges) d.ax.set_xlabel('$f_c \ MPa$') d.ax.set_title('Concrete strength n=20')
#Relative frequency d.plot_hist(bins=edges, stat='probability')
#bins=edges: limits of the bins #stat='count': number of observations at each bin d.ax.set_xlim(23,41) d.ax.set_xticks(edges) d.ax.set_xlabel('$f_c \ MPa$') d.ax.set_title('Concrete strength n=20')
==================
#EMPIRICAL CDF
#===================
d.plot_cdf_emp()
#plot the empirical cdf d.ax.set_xlim(23,41) d.ax.set_ylim(0,1) d.ax.set_xlabel('$f_c \ MPa$') d.ax.set_ylabel('ecdf') d.ax.set_title('Concrete strength n=20')
d.plot_quantile_emp() #plot the empirical quantile function d.ax.set_xlabel('$probability$') d.ax.set_ylabel('f_c \ MPa') d.ax.set_xlim(0,1) d.ax.set_ylim(23,41) d.ax.set_xlabel('$probability$') d.ax.set_ylabel('$f_c \ MPa$')
Comments