Recently in my AP Physics class I did a lab in which I measured k for a spring by setting up an oscillating system with it, and timing the period, repeating for different masses. Since $T=2\pi\sqrt{\frac mk}$, we were supposed to relate $T^2=\frac{4\pi^2}km=Cm$ for some $C$. This is a proportionality equation in $T^2$ and $m$, which we were to plot on a graph and find the slope $C=\frac{4\pi^2}k$, from which we can find $k=\frac C{4\pi^2}$.
Now my lab partner and I found the $k$ in two different ways; while I simply averaged $k_i={C_i\over4\pi^2}$ for each trial, he used statistics software to find the equation $\hat{T}^2\approx C_am+\beta$, where $\beta\approx0$ and $\bar{k}={C_a\over4\pi^2}$. He claimed that the $\beta$ term helped to eliminate error, leading to a better $k$. We recalculated $k$ by direct use of Hooke's Law and found that the percent difference was lower in my partner's case, leading me to believe that he may be correct in his method.
So, my question is, physics.stackexchange: How does using the linreg analysis on the data produce better results? Or, if this is a fluke of data and my results should have been better, why shouldn't it?
Thank you in advance.