The form of linear function is: y = ax + b. We have to determine a and b coefficients.
For example, we have two variables with their values which are displayed in two colunm.
The formulate for these coefficients as below:
a = sum of [(xi-xaverage)*(yi-yaverage)] / sum of [(xi-xaverage)2]
b = a*xaverage - yaverage
You need to calculate correlative coefficient r2. The formulate as below:
r2 = [(a*SD(xi)/SD(yi)]2
Where: SD - Standard Deviation.