Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Description: Write a program that will perform a linear regression analysis on a

ID: 649592 • Letter: D

Question

Description: Write a program that will perform a linear regression analysis on a data set provided by the instructor. The data set will consist of two columns of data separated by spaces in a text file. The two columns of data are the x and y data values recorded from a process that can be modeled by a simple f (x) = m

Description: Write a program that will perform a linear regression analysis on a data set provided by the instructor. The data set will consist of two columns of data separated by spaces in a text file. The two columns of data are the x and y data values recorded from a process that can be modeled by a simple f (x) = m · x + b equation. The idea behind linear regression is to process the the given x and y data in a way that allows you to fit the slope and y-intercept parameters in the modeled equation. The equations that perform this analysis are given below in Equation 1 and 2. In the above equations, Xk and Yk are the data points from the file. Where X0 and Y0 are the first (x,y) data set from the file, X1 and Y1 are the second values in the file and so on until all N values where XN?1 and YN?1 are the last data points in the file. The overall requirements for this problems are as follows: 1. The program should display a title banner which has the title of Linear Regression and some brief text that explains the functionality of the program. 2. The program should read the x and y data from the given file into x and y arrays. 3. Using the data now stored in program memory (The X and Y arrays), make the calculations in Equations 1 and 2 using for loops. 4. Vectorize and evaluate the same equations using the built-in Matlab sum function and matrix operators. 5. The program should output the calculated slope and y-intercept to the screen for both the loop and vectorized forms. 6. Using the polyval function, plot the original x-y data (in blue) and the best fit line from polyval and your calculated coefficents from the loop version of your program. Be sure to label axis and provide title information on the plot.

Explanation / Answer

SOMEONE PLEASE HELP US