1
$\begingroup$

The problems is as follows: you have $n$ points $(x_1,y_1),\dots,(x_n,y_n)$ and you want to fit the following equation to the data points:

$$y=\theta_1\cos(\theta_2 x+\theta_3) + \theta_4\cos(\theta_5 x+\theta_6) + e_k,$$

where $e_k$ is the error. I can replace $x$ by $t$ if needed, as clearly, the context is time series. I am trying to solve this via least squares: the solution is the parameter ($\theta_1^*,\dots,\theta_n^*)$ that minimizes the sum of squared errors. Of course you can compute the gradient, vanish it and then use some Newton-like algorithm to find the solution.

I am wondering if there is a simpler approach. Also, is it a lot easier if the phases $\theta_3,\theta_6$ are zeros? My approach, assuming $\theta_3=\theta_6=0$, is this.

  1. Start with $j=0$ and crude parameter estimates.

  2. At iteration $j+1$, compute the optimum $\theta_2,\theta_5$ using the fixed values $\theta_1,\theta_4$ obtained in the previous iteration.

  3. At iteration $j+1$, compute the optimum $\theta_1,\theta_4$ using the fixed values $\theta_2,\theta_5$ obtained in step 2.

  4. Repeat steps 2 and 3 until convergence.

Is this the best way to handle this problem? How would you do? (not to mention convergence issues)

$\endgroup$
3
  • 1
    $\begingroup$ There is a catch: if $\pi,x_1,\dots,x_n$ are independent over rationals, then you can make the error arbitrarily small in the approximation $y_j=\theta_1\cos(\theta_2x_j)$ already, so without some "sanity constraints" the problem is ill-posed in general. $\endgroup$
    – fedja
    Commented Aug 16, 2022 at 1:27
  • $\begingroup$ @fedja: you need to add this constraint: $|\theta_1|\geq|\theta_4|$. Not sure this is enough, but it is definitely needed. $\endgroup$ Commented Aug 16, 2022 at 13:10
  • $\begingroup$ In my remark $\theta_4=0$, so no, this constraint is not very useful... $\endgroup$
    – fedja
    Commented Aug 16, 2022 at 21:59

0

You must log in to answer this question.