>I'm looking for a subroutine that will perform a regression analysis on data in a Foxpro table. Anyone have any suggestions of where to look? Thanks...
The "best fit" is defined as the line where the squares of the distances of the individual data points, from the resulting line, is at a minimum.
Excel help, for the corresponding functions, explains how Excel does the calculation.
Basically, it seems that for a single independent variable, x, the slope m would be:
sum((x - xx)(y - yy))
m = --------------------------
sum((x-xx)^2)
and the intersect, b:
b = yy - m*xx
Where I used xx and yy for the average values of x and y. If I understand correctly, the two sums must be done separately, adding the formula result for all the data points.
HTH,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)