Curve fitting a circle (as in linear regression) I have points in a plane and I want to fit a circle to these points. Is there a 'regression-type' to these points, somewhat akin to linear regression, with a corresponding $R^2$ value? Your insights please.
 A: Love the question! I think I would go about it like this: If you have tuples of x- and y-coordinates in a data set as $D = \{(x_1,y_1), (x_2,y_2), \dots, (x_n,y_n) \}$ and your hypothesis would be that there exist $h,k$ and $r$ s.t.
\begin{align}
 (x_i-h)^2 + (y_i-k)^2 = r^2 + \varepsilon_i ,
\end{align}
with $\varepsilon_i$ being some error centered at zero and with finite variance (i.e., with conditions that make regressions feasible).
Rewriting the above gives you
\begin{align}
 x_i^2 - 2x_ih + h^2 + y_i^2 - 2y_ik + k^2  = r^2 + \varepsilon_i,
\end{align}
and you want to get estimates $\hat{h}, \hat{k}, \hat{r}$. So you define $\alpha = r^2 - k^2 - h^2$ and rewrite the above as 
\begin{align}
 (x_i^2 + y_i^2)  =  \alpha + 2x_ih + 2y_ik + \varepsilon_i,
\end{align}
where the left hand side gives you the independent variable of your regression equation,and the left hand side gives you three regressors: the constant/intercept ( = $\alpha$) as well as $2\cdot x_i$ and $2\cdot y_i$ with corresponding coefficients $h$ and $k$. Now finally, note that because $r>0$ by definition of the radius, we can estimate $\hat{k}$ and $\hat{h}$ to recover $r$ from $\hat{\alpha}$ as $\hat{r} = \sqrt{\hat{\alpha} - \hat{k}^2 -\hat{h}^2}$ so long as it holds that $\hat{\alpha} > \hat{k}^2 + \hat{h}^2$. 
If the requirement that $\hat{\alpha} > \hat{k}^2 + \hat{h}^2$ is violated in practice (note: If your error term $\varepsilon_i$ has mean zero and finite variance, then the estimates $\hat{\alpha}, \hat{k}$, and $\hat{h}$ are all consistent, implying that $\mathbb{P}(\hat{\alpha} > \hat{k}^2 + \hat{h}^2) \to 0$ as $n \to \infty$, suggesting that a violation of that requirement might be due to insufficient sample size or your data not being arranged in a circle),
I would start looking into constrained linear regressions that are intimately linked with linear programming techniques, see for instance here: How do I fit a constrained regression in R so that coefficients total = 1?
