Problem definition
Consider a dataset composed by $m$ bivariate measurements \begin{equation*} y_j \sim \mathcal{U}(\mathcal{E}(\ell_1,\ell_2,\theta)) \qquad j=1,2,\dots,m \end{equation*} uniformly distributed over an ellipse centered in the origin, with semilength $\ell_1$, semiwidth $\ell_2<\ell_1$ and orientation $\theta\in[0,2\pi)$. The orientation angle $\theta$ is the angle between the horizontal axis and the longitudinal axis, where for longidutinal axis I mean the direction of the two major semiaxes that define the semilength of the ellipse.
My objective is to estimate $\theta, \ell_1, \ell_2$ given the dataset $y_{1},\dots,y_m$.
A starting solution
The idea is to compute the sample covariance of the dataset \begin{equation*}\begin{aligned} S&\triangleq \frac{1}{m-1}\sum_{j=1}^m (y_j-\bar{y}) (y_j-\bar{y})'\\ \bar{y}&\triangleq\frac{1}{m}\sum_{j=1}^m y_j \end{aligned}\end{equation*} and then use the eigenvalues-eigenvectors decomposition \begin{equation*} S=U\Lambda U' \qquad U\triangleq\left[\begin{array}{cc} \cos \hat{\theta} & -\sin\hat{\theta} \\ \sin \hat{\theta} & \cos\hat{\theta} \\ \end{array}\right] \qquad \Lambda \triangleq \left[\begin{array}{cc} \lambda_1 & 0 \\ 0 & \lambda_2 \end{array}\right] \end{equation*} to extrapolate $\ell_1,\ell_2,\theta$ as follows \begin{equation*} \begin{aligned} \hat{\ell}_1 &\triangleq k \sqrt{\Lambda_{11}} \\ \hat{\ell}_2 &\triangleq k \sqrt{\Lambda_{22}} \\ \hat{\theta} &\triangleq \cos^{-1}(U_{11}) \end{aligned} \end{equation*} where $k$ is a suitable scaling factor that must be determined.
A more detailed solution
The previous solution assumes to have an algorithm, treated as a black-box, to diagonalize $S$. Then uses the factors $U, \Lambda$ to define the estimates. Since we are dealing with a $2\times2$ matrix, we can readily solve the diagonalization analytically. This approach provide a better understanding about whats going on in this estimation process. Let \begin{equation*} S=\left[\begin{array}{cc} S_{11} & S_{12} \\ S_{12} & S_{22} \end{array}\right] \end{equation*} then, we can start to search for the eigenvalues, which are the two solutions $\lambda_{1,2}$ of the quadratic equation \begin{equation*} \text{det}\lambda I-S)=0 \qquad \equiv \qquad \lambda^2 - (S_{11}+S_{22})\lambda+S_{11}S_{22}-S_{12}^2=0 \end{equation*} The eigenvalues are \begin{equation*} \lambda_{1,2} = \frac{S_{11}+S_{22}\pm \sqrt{(S_{11}-S_{22})^2+4S_{12}^2}}{2} \end{equation*} and, up to a scaling factor $k$, \begin{equation*} \begin{aligned} \hat{\ell}_1 &= k \sqrt{\lambda_1} \\ \hat{\ell}_2 &= k \sqrt{\lambda_2} \end{aligned} \end{equation*}
Now, we can search for the eigenvectors. Setting a generic normalized eigenvector \begin{equation*} v\triangleq \left[\begin{array}{c} \cos \hat{\theta} \\ \sin \hat{\theta} \end{array}\right] \end{equation*} in the system of equations \begin{equation*} (\lambda I - S) v= 0 \end{equation*} gives the equation (for the first component of system, evaluated in $\lambda=\lambda_1$) \begin{equation*} (\lambda_1-S_{11})\cos \hat{\theta}-S_{12}\sin \hat{\theta} =0 \end{equation*} from which follows \begin{equation*} \hat{\theta} = \tan^{-1}\left(\frac{\lambda_1-S_{11}}{S_{12}}\right) = \tan^{-1} \left(\frac{S_{22}-S_{11}}{2S_{12}}+\sqrt{1+\left(\frac{S_{11}-S_{22}}{2S_{12}}\right)^2}\right) \end{equation*}
Questions
- Is there a better approach to estimate the parameter of the underlying ellipse?
- I'm not sure about the scaling factor. Given that exists, what is its value (or a reasonable appproximation)?