Combined Polynomial and Periodic model

American Association of Variable Star Observers (AAVSO)
Sat, 05/14/2022 - 15:15

Previously,  if you had data containing a polynomial trend and periodic data, could not fit a single linear model containing both polynomial terms and sinusoidal terms as you can with the "lm" function in R. Is that still the case, or is there now a way with the Vela language to fit a model of the following form - assuming a 3rd order polynomial and N harmonics (including the fundamental):

A_0 + A_1*X + A_2*X^2 + A_3*X^3 + A_4*SIN(2π/P) + A_5*COS(2*π/P) + . . . + A_(2N+2)*SIN(2*N*π/P) + A_(2N+3)*COS (2*N*π/P)

Sorry about the "mixed" notation but I don't know how to write a normal algebraic expression in AAVSO forums. P is the known period of the fundamental. 



Astronomical Society of South Australia (ASSAU)
Fitting of VeLa models

I know I've given an example or two of combining a polynomial VeLa model and one or more Fourier VeLa models that already have coefficients determined from a fitting process (and I should add an example to the GitHub wiki), but what you cannot yet do is start with a VeLa model that has no fit coefficient and get one that does. This has been on my mental TODO list for awhile but I've added an issue now:

There are a few ways to render equations from LaTeX via a URL, e.g pi squared + 2:\pi^2%20%2b%202

when embedded in an img HTML element:

<img src="^2%20%2b%202 />

should give a nice rendering of  pi squared, but does not here. You can still click on the link above to see it though.

This would get ugly quickly for your equation. There are probably ways we can do this via Source mode when editing comments here but would need to spend time looking this. Better would be if it was built in to the editor. Wordpress has plugins for this for example. Another way is just to use an online LaTeX editor and point to it. Should be an easier way though.