Programming in C Help

Whenever variables X, Y are related it may be possible to express that relationship as a linear function or line. The process of finding the "best" line minimizes the squares of the vertical distances of the points from the line, hence, the name method of least squares. The process is known in statistics as linear regression. The equation of the line can be written Y = mX + b, where Y is being predicted from X and m is the slope of the line and b is the Y intercept. Slope: m=ΣXY-ΣXΣYNΣX2-(ΣX)2N

Y intercept: b=ΣYN-mΣXN

There are many applications of line fitting.  In the area of business, one could collect data on the cost Y to produce X units of a product.  Upon fitting several X,Y data points, the intercept b would represent the fixed production cost and the slope m would be the variable cost per unit.  In some cases the quantities X and Y may require transforming before being fitted to a line but such transformations will not be needed for the data to be processed by this program.

Code a program to perform line fitting.  The X,Y data pairs will be provided in a file that can be read using fscanf.  Display the slope and intercept corresponding to the data set read from the file along with the following additional statistics:

Mean of X: X=ΣXN

Mean of Y: Y=ΣYN

Standard deviation of X: SX=SSXN

Standard deviation of Y: SY=SSYN

Correlation coefficient: γ=ΣXY-(ΣX)(ΣY)N(SSx)(SSy)

Standard error of estimate: Sest,Y=SY 1-γ2

where: SSX=ΣX2-(ΣX)2N; SSY=ΣY2-(ΣY)2N

Assignment(11B): Linear Regression (modified to use arrays)

Make a new version of the previous assignment that uses arrays to store the X and Y values. This will change the structure of the program slightly such that the while loop will only be reading the X and Y values from the file and placing them into the array. All the computations will be done after the while loop as terminated.

this what the problem is

/r/programmingchallenges Thread