I am not sure what level you are from the question as asked. The methods presented so far have been sort of down-in-the-ditches, concentrating on getting the results rather than understanding the problem.

The problem states "Fit the data using the method of least squares". It does not say to fit the model using Excel, RStudio, SPSS, or any other software product. Be also careful because Excel computations for this kind of problem have been called into question.

If your goal is to just "get the answer", then definitely use software to get the answer. But if you want to understand least squares, then you should work it mostly by hand with only a little help from a calculator.

It's important to understand the framework of Statistics. Statisticians have spent many years studying the various assumptions, and yet it's easy for a careless researcher to misuse Multiple Regression to prove hypotheses which are not valid.

Each Multiple Regression assumes a particular mathematical model. If the model is not as expected, the results will not be reliable and things will go very wrong. A regression model can be linear or non-linear, and can have a number of odd twists if certain assumptions are not satisfied, or if the wrong independent variables are in the model, or if the independent variables are correlated, or if the errors are correlated.

If the assumptions for a Multiple Regression with a linear model are satisfied, then the general equation for Multiple Regression with a dependent variable Y and a matrix of coefficients of the dependent to independent variables X is **Y = Xβ + u**, where u is a vector of the error values for the Y observations.

The general solution to a Multiple Regression problem in the linear case where β-hat is the estimate of β and X^{T} is the transpose of the matrix X is

** β-hat = (X**^{T}X)^{-1}X^{T}Y

This general solution is obtained by taking the derivative of the sum of squared residual values, and setting it to zero to find the minimum, which is why the technique is called "least squares". (This technique uses the Euclidean distance as a measure of the deviations, and one should note that if a different metric for distance were used the results could be different.)

In this case, Y is the 20x1 vector of dependent variable values containing 78, 65, ... , 192, and X is the 20x3 matrix of the dependent variables latitude, longitude, and depth. The vector β is the 3x1 matrix of unknown coefficients β_{1} β_{2} and β_{3. }

Matrix operations are very straightforward, and make the formulas you need to solve these problems much easier to remember.

_{ }