Department of Mathematics

Math 583: Mathematical Hacking

ICE 6

Use the work from last week's ICE to write a Python class called "regressionLine" that describes a linear regression fit to a set of data. The constructor should take two arguments: a list/array of x coordinates for the data; and a list/array of y coordinates for the data. It should compute a slope and intercept for the fitted line using a function from the scipy.stats package:

slope,intercept,rValue,pValue,stdErr = stats.linregress(xValues,yValues)
  
It should also maintain maintain attributes for those variables. It should contain a method that plots the data and fitted line.





Assignment 3 is posted.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 2009-15 Kevin Cooper