Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#IrisDataslr10_xls 3.5,5.1 3,4.9 3.2,4.7 3.1,4.6 3.6,5 3.9,5.4 3.4,4.6 3.4,5 2.9,4.4 3.1,4.9 3.7,5.4 3.4,4.8 3,4.8 3,4.3 4,5.8 4.4,5.7 3.9,5.4 3.5,5.1 3.8,5.7 3.8,5.1 3.4,5.4 3.7,5.1 3.6,4.6 3.3,5.1
#IrisDataslr10_xls
3.5,5.1 3,4.9 3.2,4.7 3.1,4.6 3.6,5 3.9,5.4 3.4,4.6 3.4,5 2.9,4.4 3.1,4.9 3.7,5.4 3.4,4.8 3,4.8 3,4.3 4,5.8 4.4,5.7 3.9,5.4 3.5,5.1 3.8,5.7 3.8,5.1 3.4,5.4 3.7,5.1 3.6,4.6 3.3,5.1 3.4,4.8 3,5 3.4,5 3.5,5.2 3.4,5.2 3.2,4.7 3.1,4.8 3.4,5.4 4.1,5.2 4.2,5.5 3.1,4.9 3.2,5 3.5,5.5 3.6,4.9 3,4.4 3.4,5.1 3.5,5 2.3,4.5 3.2,4.4 3.5,5 3.8,5.1 3,4.8 3.8,5.1 3.2,4.6 3.7,5.3 3.3,5
PYTHON
Problem 1. The data file IrisData_s/r10.xls contains data for Iris Setosa in 3 columns: Entry number, sepal width, sepal length, in an Excel file. Using matrix regression as shown above, fit a model y=0+1x, where x is the sepal width and y is the sepal length. Plot the data with the regression line superposed upon it. Comment on the fit of the model. To read an Excel file into Python, use the Pandas module. - import pandas as pd - dataxy = pd.read_excel (excelFilename) . - dataXy.head() \# will display the first few lines of *dataXY*. - mydataArray = np.array(dataXy) \# will create a **2-D numpy array** that you can use. - x= mydataArray [:,0] \# 1st column is x (and 2nd column is y ). - y= myDataArray [:,1] - To create the X matrix shown above: - c1=np.ones (len(x)) \# Create a column of 1 's - x=npcolumn stack ((c1,x)) Plot the residuals ei=yiy^i versus y, where yi is the data value corresponding to xi and y^i=b0+b1xi is the value given by the model at the point xi. The plot of ei versus x and the plot of ei versus y should not show any pattern. You only need make one of the two plotsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started