I am struggling to model the correlation shown in the figure so that I can predict the positive values of y beyond the observed range:
The correlation between y and x appears oscillatory and characterised by:
- increasing amplitude;
- increasing period;
- asymmetric oscillations.
I was able to define functions that satisfy some of these features, but I could not find a function that satisfies all these features at once. Can you help me do it?
Here is what I was able to accomplish so far, using R:
A function characterised by increasing amplitude
x <- seq(0, 10, by=0.01)
a = 9 # controls amplitude change rate
b = 1.2 # controls frequency change rate
y <- x*b*sin(x*a) # increasing amplitude
The grey line shows what I am attempting to model, the red line is the function in the graph title.
A function characterised by increasing amplitude and period
b = 1.2 # b controls rate of amplitude increase
g = 10
h = 200
# g and h control rate of period increase
y4 <- x*b*sin(exp(g-x)/h)
This function goes flat by x~7.
The grey line shows what I am attempting to model, the red line is the function in the graph title.
A function characterised by asymmetric oscillations
I was able to model this with a modified Clausen function of order 2:
d=4.5 # changes frequency
f=2 # changes amplitude
clausen2 <- f*sin(x*d) + f*sin(2*x*d)/4 + f*sin(3*x*d)/(3^2) + f*sin(4*x*d)/(4^2) +
f*sin(5*x*d)/(5^2) + f*sin(6*x*d)/(6^2) + f*sin(7*x*d)/(7^2) + f*sin(8*x*d)/(8^2) +
f*sin(9*x*d)/(9^2)
The grey line shows what I am attempting to model, the red line is the function in the graph title.
I am not sure if I am overcomplicating things and/or missing something obvious.
Best Answer
Following your idea of the Clausius function $$S_2(x)=\sum_{m=1}^N \frac{\sin(m x)}{m^2}$$ (cut off at $N$ terms) you can define a function whose amplitude $A(t)$ varies with $t$ and whose frequency, specified in terms of $x=\omega(t) t$, quantifies the rapidness of oscillation, scales with $t$. A first estimate (for constant $\omega(t)$) from your plot guided me to choose $A(t)=1.2 t$, $\omega(t) t=3.2 t$. Moreover, I took $N=20$ terms to obtain
$$f(t)=A(t)S_2(\omega(t) t)$$
given a plot similar to yours.
A version with decreasing frequency $\omega(t)= 20.2 t^{-0.7}$ and increasing amplitude (as in your plot), e.g. $A(t)=1.2 t$, yields
You can numerically try to fit other parametrized functions $A(t)$ and $\omega(t)$ to match your data exactly.