m = n ∑ i = 1 n x i y i − ∑ i = 1 n x i ∑ i = 1 n y i n ∑ i = 1 n x i 2 − ( ∑ i = 1 n x i ) 2 {\displaystyle m={\frac {n\sum _{i=1}^{n}x_{i}y_{i}-\sum _{i=1}^{n}x_{i}\sum _{i=1}^{n}y_{i}}{n\sum _{i=1}^{n}x_{i}^{2}-(\sum _{i=1}^{n}x_{i})^{2}}}}
q = ∑ i = 1 n y i − m ∑ i = 1 n x i n {\displaystyle q={\frac {\sum _{i=1}^{n}y_{i}-m\sum _{i=1}^{n}x_{i}}{n}}}