The theory of errors and method of least squares