ProgramTheSumWithCorrelationCoefficientAndDataFileInput

advertisement
ProgramYourOwnLeastSquares (DIY Least Squares)
Earlier, you used a general purpose programming tool (Qbasic, QuickBasic, TurboPascal,
Fortran, C or even Visual Basic for Excel) to compute the coefficients a and b (as in y =
a + bx) in a linear least squares fit (even before that, you derived these formulae). The
program you wrote earlier prompted you to input the x,y data pairs (in the case of Excel,
you just put these numbers in two columns).
Now extend that program in two important ways:
1. Get the program to ask you for a data file containing data pairs; this makes it possible
to analyze large data sets generated by an instrument.
2. Retain the computation of intercepts and slopes.
3. Get the program to compute the linear correlation coefficient.
4. Test the dataset on a file containing at least 1000 data pairs; typically, these will be
separated by some kind of delimiter, such as comma or tab.
Grading Criteria. For 70%, include this page as coversheet, a printout of the program
code, and demonstrate to the TA your program works. For 30% describe in a
paragraph the meaning of the correlation coefficient.
Download