chi squared fit in 3D I want to fit a line to $N$ 3D data points $(x,y,z)$, where $x,y$ are fitted and $z$ is fixed for all data points.
To fit the data, I use the following $\chi^2$ fit:
$$
\chi^2(a, b)_h=\sum_{i=1}^N \left (\frac{h_i-a-bz_i}{\sigma_i}\right)
$$
Would it be correct if, to receive the best set of parameters, the following is minimized:
$$f_{min}=\text{min}(\chi^2_x+\chi^2_y).$$
My reasoning for this is that
$$\sum d_{x,y}^2=\sum d_x^2+ \sum d_y^2$$
holds. If it is correct, can I use $f_{min}$ for the gof, or do I need to consider something additionally?
Thanks in advance!

If the distribution of $x$ and $y$ is independent when corrected for $z$ then you could regard the fit as a fit with 1D data. (by treating the pairs $x_i,y_i$ as two independent data points with the same value of $z$ as predictor)
Then you are fitting a line with 4 parameters and can use the least squares method and use the sum of squares as a hypothesis test for the goodness of fit (which might likely fail if a straight line is not exactly correct so I actually wonder what you want to prove with a gof test).
But you might have a situation where the $x$ and $y$ variables are not independent. In that case the least squares method is not the 'best' (instead you probably want to use generalized least squares) and the sum of squared errors is not chi-squared distributed.
See the Gauss Markov theorem for more about the conditions and background that makes the least squares method the 'best' method. The least squares method is only the best among unbiased linear estimators when the errors are distributed with equal variance and are independent. Also the method is only the best in terms of having the lowest variance of the estimate, potentially with other measures of performance the least squares method is not the best (the UMVE is also the best estimator for other convex functions. But I am not sure this generalizes to linear estimators. I also imagine this requires the distribution of the errors to be identical and not just the same variance).
