This page outlines Tutorial 2 [link]
The following are the commands used:
First use nano and create a file named data02.py, and add the following lines: import numpy as np import pandas as pd import sys import matplotlib.pyplot as plt xval = 'Infant MR'; yval = 'Heart Disease DR'; file='1111' ver=pd.read_csv("datasets/df.csv") plt.xlabel(xval) plt.ylabel(yval) plt.scatter(ver[xval],ver[yval]) plt.show() f2= file+".svg" plt.savefig(f2,format='SVG') f2= file+".png" plt.savefig(f2,format='PNG')
And Part II:
import numpy as np import pandas as pd import sys import matplotlib.pyplot as plt import statsmodels.api as sm xval = 'Infant MR'; yval = 'Heart Disease DR'; file='1111' ver=pd.read_csv("datasets/df.csv") plt.title(yval+' v ' + xval) plt.xlabel(xval) plt.ylabel(yval) plt.scatter(ver[xval],ver[yval]) plt.show() axes = plt.gca() m, b = np.polyfit(ver[xval], ver[yval], 1) X_plot = np.linspace(axes.get_xlim()[0],axes.get_xlim()[1],100) plt.plot(X_plot, m*X_plot + b, '-') if (b>0): print yval,'=',round(m,3),' x ',xval,'+',round(b,3) else: print yval,'=',round(m,3),' x ',xval,round(b,3) print sm.OLS(ver[xval], ver[yval]).fit().summary() f2= file+".svg" plt.savefig(f2,format='SVG') f2= file+".png" plt.savefig(f2,format='PNG')