1. The squared difference between each X and the X mean is found and these squared differences are summed.2. The products (X – X mean) * (Y – Y mean) are found for each pair of data points and summed.3. SLOPE is then computed as the ratio of the second of these sums to the first.From http://support.microsoft.com/kb/828142
X mean: X的平均值 slope = Sum((X – X mean) * (Y – Y mean)) / Sum((X – X mean) * (X – X mean))
如果有3组数据:x=1,y=2; x=3,y=4; x=5,y6; (X – X mean)、(Y – Y mean),那么X,Y 分别取几?(不是X mean,Y mean)
Sum((X – X mean) * (X – X mean)) 意味着: (x1 - X mean)*(x1 - X mean) + (x2 - X mean)*(x2 - X mean) + (x3 - X mean)*(x3 - X mean) 也就是(其中3是X的平均值): (1-3)*(1-3) + (3-3)*(3-3) + (5-3)*(5-3)
slope = Sum((X – X mean) * (Y – Y mean)) / Sum((X – X mean) * (X – X mean))
(X – X mean)、(Y – Y mean),那么X,Y 分别取几?(不是X mean,Y mean)
意味着:
(x1 - X mean)*(x1 - X mean) + (x2 - X mean)*(x2 - X mean) + (x3 - X mean)*(x3 - X mean)
也就是(其中3是X的平均值):
(1-3)*(1-3) + (3-3)*(3-3) + (5-3)*(5-3)