I am interested in knowing where do regression models of the form: $$ \phi(x,A,B,C)=A\sin(kx+B)+C $$ for a given $k\in\mathbb{R}$ are applied in domains such as engineering and science. What example are there that requires the use of this model?

I had encountered this model recently on math stack exchange. I would suspect the use of this model would be in a domain that heavily requires the use of signal processing but I can't seem to find any answer on the web of any application of sine regression.

These questions on MATHSE are mainly about how to transform the nonlinear sine model to a linear one via substitution in order to be solved numerically (such as using the normal system)



  • 2
    $\begingroup$ Ha! I honestly just solved a problem using this today! We wanted to ignore the effect of a background 60hz signal (caused by nearby AC power), that is, we wanted to determine C from sampled data points. Maybe I'll write up an answer... $\endgroup$ Jul 22, 2021 at 1:31
  • $\begingroup$ Thank you very much for your answer!! @Cam.Davidson.Pilon $\endgroup$ Jul 22, 2021 at 5:28

6 Answers 6


Forecasting a process with seasonalities, i.e., recurring patterns. Sinusoidals, or higher Fourier terms, are especially useful if you have seasonalities with long periods, e.g., for daily or weekly data with yearly seasonalities, or for minutely data with daily seasonalities. My answer to Linear regression with “hour of the day” gives a few examples. Alternatively, take a look at the TBATS model for forecasting data with "complex" seasonalities, where the "T" stands for "trigonometric". A literature reference is given in the "multiple-seasonalities" tag wiki.

  • $\begingroup$ Thank you for your answer I will check these references $\endgroup$ Jul 20, 2021 at 16:45

Harmonic regression is your term. There's an equivalent and possibly easier form to deal with: $A\sin \omega t+B\cos \omega t+c$. This is also called a regression with Fourier predictors.

This is used anywhere where you expect constant wave like pattern in data, e.g. seasonality in sales revenues or prices. You often use more than one harmonic though, e.g. $ \omega t,2 \omega t,\dots$ to reproduce more complex patterns than a perfect sine wave

  • $\begingroup$ You claim this is "used anywhere where you expect a constant wave-like pattern in data", and you give the example of sales, but I seriously question this. In my experience, regression for time uses lagged coefficients or dummy variables for season to handle these fluctuations. $\endgroup$
    – AdamO
    Jul 20, 2021 at 21:23
  • 1
    $\begingroup$ @AdamO, I added a link to Hyndman's book in my answer, which should make ease your doubts. Also, see this remark on why lagged coefficients don't work in some cases. The dummy approach is the same as Fourier if you have full set of dummies, but may work better if you only have dummies for one or two periods. I always try Fourier for seasonality treatment and use it if it works better, which isn't always the case. Sometimes dummies work better $\endgroup$
    – Aksakal
    Jul 20, 2021 at 22:15
  • $\begingroup$ I think you're missing a coefficient somewhere, because $\sin \omega t + \cos \omega t$ is the same as $\sqrt 2 \cdot \sin (\omega t + \pi / 4)$. Maybe you meant to write $A \sin \omega t + B \cos \omega t + c$? $\endgroup$ Jul 21, 2021 at 1:19
  • $\begingroup$ @TannerSwett thanks, corrected $\endgroup$
    – Aksakal
    Jul 22, 2021 at 2:22

There's a whole book on Bayesian approaches to this type of problem: Bayesian Spectrum Analysis and Parameter Estimation by Bretthorst (1988). The underlying problem domain was in nuclear magnetic resonance (NMR) signal processing.

  • $\begingroup$ Thank you for your answer I will check out the book $\endgroup$ Jul 20, 2021 at 16:45

I have worked in a few different research areas that dealt with unknown periodic trends. In my experience there are almost always better analytic methods to estimating these trends. It turns out that this model, while seeming quite general, actually has too many stringent assumptions. Add to that, the model can't be uniquely identified (offsetting $B$ by $\pi/2$ is equivalent to changing the sign of $A$). Here are the examples I worked on:

  1. Premise: A colony of frogs are observed to migrate from one end of an aquarium to another at an unknown period. Solution: Frogs are affixed with GPS and Euclidean distance from a reference point is mapped over time, forming a sinusoidal trend. The period is estimated with fast Fourier transform (FFT). This is the scientific question and we are done, the amplitude is not of concern.

  2. Premise: PM10 pollutant levels are observed to fluctuate seasonally, and researchers wish to have a granular-in-time prediction model. Solution: seasonality is already known. Plus pollutant levels vary according to other important regression features. Universal kriging is used. Land-use variables -- the regression component -- include model terms for season, so amplitude is known.

  3. Premise: Ionic concentration outside the cardiac membrane is measured as a function of time to assess regular heart beat. The goal is to identify irregular heart beat. Solution: Nothing about the trend is known, the assumptions of sinusoidal regression are too stringent to provide any good alignment of depolarization of heartbeat. A first pass box car filter is used to identify ends of action potential and segment the series. The series are aligned based on depolarization, and smoothing splines are used to regress. Then outliers are identified by MSE for ionic concentration, or by duration.

A good reference for this might be Peter Diggle's Time Series A Biostatistical Introduction


We have a very sensitive optics system¹, where our signal changes slowly over time. However, there is a background noise of 60hz caused by nearby AC current. We sample 25 points over a second, and recover data like:

time  signal
0.011 1546
0.044 1615
0.081 1772
0.115 1795
0.802 1792
0.838 1498
0.873 1507

Plotted, it looks like: enter image description here

Note that the periodic behaviour above is aliasing from the 60hz signal.

We could just take the sample average of all points to get a estimate of the signal, but this isn't efficient: consider what happens when the samples start and end both “high”, or both “low” - this biases the average up, or down, respectively.

Instead, we directly model the system using the sinusoidal regression:

$$f(t, A, B, C) = C + A \sin(120\pi t + B) $$

Like the links in the question, we expand this as:

$$f(t, A', B', C) = C + A' \sin(120\pi t) + B'\cos(120\pi t) $$

which turns our problem into a linear regression problem. Solving using least squares and converting back to the original parameterization gives:

C = 1676.40
B = 1.46
A = 200.74

Plotting the fitted model vs the observed:

enter image description here

We use the value of C, 1676.4, as our final estimate. Note that this is different from the sample average of 1654.0.

¹ We are measuring low light signals that bounce of cells in our bioreactors.


Just an example that I often perform on MATLAB with my students: content of La Baells dam on Llobregat River, in Catalonia, from 2007 to 2017.

First I run this regression:

$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25)+K$$

where $T$ is time in days and $vol$ is water content in cubic hectometres:

vol=Asin(T\cdot 2 \cdot pi/365.25)+Bsin(T/365.252pi)+K

That reveals the seasonal nature of water content. A closer inspection reveals a maximum in spring and a minimum in fall because in Central Catalonia the summer is the driest season, so precipitation is at minimum and water usage for irrigation and other uses is at maximum. We can also see that in 2007 we had a severe drought and that rainfall is quite irregular across years.

That can be improved by adding an harmonic:

$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25) + C \cdot sin(T\cdot 2 \cdot pi/365.25/2) + D\cdot cos(T\cdot 2 \cdot pi/365.25/2)+K$$

enter image description here

And here we can see a secondary maximum in early winter, after fall rains - fall is the second season with most precipitation, after spring.

The next few harmonics don't seem to improve the fit, and therefore they aren't included in this post.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.