Bilinear regression

I have read a couple of posts on least squares regression of a sine wave, which is essentially what I am trying to do.

However, they both include reference to bilinear regression as part of the solution, but unfortunately don't cover that part. I have searched around the net but every result seems to use very complicated notation that I cannot follow. Can someone please give me a simple example of bilinear regression in the context of determining the coefficients of a best fit sine function?

Thanks.

EDIT: To add a bit more info, I have test data collected whilst driving a vehicle around a circle at increasing speed and measuring its response. This particular query relates to the roll behaviour, which increases almost linearly with lateral acceleration. However, the roll data also contains a once per circle variation due to gravity, which is the sinusoid I am trying to fit to so it can be removed.

If I plot roll angle against circles (yaw angle/360), then the variation is obvious. I've tried FFT and DFT techniques to remove the once per circle variation but they are not robust. My best guess at the reason why is that the results are being affected by the underlying trend in the data, which isn't periodic. Even after subtracting a third order polynomial from the data, the results are still hugely sensitive to small differences between runs.

So, I have changed tack and am trying a best fit sinusoid method, hence my post here.

• If you joint to the question a representative example of data you have more chances to have an answer with clear explanation how to proceed. Commented Sep 23, 2022 at 7:29
• Yes, I appreciate that. However, my datasets have two channels in it that are over 10k points, hence I'm looking for some discussion to get me going. I will add some extra information though. Commented Sep 23, 2022 at 8:09

Continuing from the first link Least squares regression of sine wave

you model now looks like

y = A * S + B * C

Where y is your data vector, S, C are the sin and cos vectors, and A, B scalars

A and B are found by projecting y onto S and C respectivly.

EG

A * S = proj_S( y ) "Projection of y onto S"

= [dot(y, S) / dot(S, S)] * S

B * C = proj_C( y )

= [dot(y, C) / dot(C, C)] * C

• Thanks for the response to my post. I have a couple of questions. When projecting vectors, shouldn't the denominator of the fraction be a magnitude rather than a magnitude squared? Is this bilinear regression? I expected there to be minimising of residuals and so on. Commented Sep 30, 2022 at 2:40
• This video runs you through the calculation, duckduckgo.com/… at ~5 minute mark you can see the square, and square root cancel. As for the bilinear regression part, I'm not an expert so if its important perhaps try and verify this, but my understanding is least squares regression in vector space equates to trying to find the cloest vector of the model (S & C) for the measured values (y). Ie the projection is the minimised solution.
– acon
Commented Oct 1, 2022 at 8:05