# “accelerating” cosines

Fitting a quadratic model to an incomplete number of cycles of a periodic function can give the false impression of an “acceleration” or deceleration.

Here, synthetic data was made using a folded cosine and an upward linear trend, similar in size and form to the global sea level record reported by Jevrejeva et al 2014.

A quadratic model was fitted to the data.
The result slightly reduces the real linear trend and fits a spurious upward acceleration.

This is because of the incomplete cyclic part towards the end producing an upwards bias.

Final set of parameters Asymptotic Standard Error
======================= ==========================
a = 0.00178066 +/- 0.0002117 (11.89%)
b = 1.73492 +/- 0.03279 (1.89%)
c = -120.217 +/- 1.065 (0.8858%)

A similar demonstration of fitting a linear model to incomplete cycles:
https://climategrog.wordpress.com/?attachment_id=209

Code to reproduce the above graph using gnuplot 4.x

### simulate jevrejeva tide gauge quad fit since 1860

cos1(x)=a1*abs(cos(2*pi*(x-yz)/p1))
yz=1945; p1=120; a1=50;
lin(x)=m_lin*(x-1940)
m_lin=2.25

set key top left Left reverse
plot [1860:2010] lin(x)+cos1(x)
set table &quot;tide_sim.dat&quot; ; replot; unset table  # write sim data to file

fit  [1860:2010] quad(x) &quot;tide_sim.dat&quot; using 1:2 via a,b,c
plot [1860:2010] lin(x)+cos1(x) title &quot;50mm abs_cos + 2.25 mm / yr linear &quot;, quad(x) title &quot;quadratic fit&quot;

set title &quot;Fitting Quadratic Acceleration to Cosines&quot;
set label 1 sprintf(&quot;fitted quadratic coeff x 2 = %.4f mm.yr^-^2&quot;,a*2) at graph 0.05, 0.8
set label 2 sprintf(&quot;fitted quadratic coeff     = %.2f mm.yr^-^1&quot;,b) at graph 0.05, 0.75
replot

# Final set of parameters            Asymptotic # Standard Error
=======================            ==========================
# a               = 0.00178066       +/- 0.0002117    (11.89%)
# b               = 1.73492          +/- 0.03279      (1.89%)
# c               = -120.217         +/- 1.065        (0.8858%)

#