sinewavePDF {ADMUR} | R Documentation |
PDF of a truncated sinusoidal curve
Description
Probability density function for a truncated sinusoidal curve.
Usage
sinewavePDF(x, min, max, f, p, r)
Arguments
x |
Numeric vector of years |
min , max |
Lower and upper \(x\) limits of the distribution |
f |
Numeric frequency (cycles per unit \(x\)). |
p |
Numeric between \(0\) and \(2\pi\), giving the cycle position (in radians) at \(x = 0\). |
r |
Numeric between 0 and 1, determining how flat the distribution is. |
Details
The usual function to describe a sine wave is \(f(x) = A\sin(2\pi f x + p)\), where \(A\) is the amplitude, \(f\) is the frequency (cycles per year), and \(p\) is the cycle position (in radians) at \(x = 0\), and therefore oscillates above and below the x-axis.
However, a sinusoidal PDF must by definition always be non-negative, which can conceptually be considered as a sine wave stacked on top of a uniform distribution with a height \(A + k\), where \(k >= 0\). Since the PDF is \(f(x)\) divided by the area below the curve, A and k simplify to a single parameter \(r\) that determines the relative proportions of the uniform and sinusoidal components, such that:
when \(r = 0\) the amplitude of the sine wave component is zero, and the overall PDF is just a uniform distribution between min and max.
when \(r = 1\) the uniform component is zero, and the minima of the sine wave touches zero. This does not necessarily mean the PDF minimum equals zero, since a minimum point of the sine wave may not occur with PDF domain (truncated between min and max).
Therefore the formula for the PDF is:
\[\frac{1 + \sin(2\pi f x + p) - \ln(r)}{(x_{max} - x_{min})(1 - \ln(r)) + (\frac{1}{2\pi f})[\cos(2\pi f x_{min} - p) - \cos(2\pi f x_{max} - p)]}\]where \(x =\) years, and \(x_{min}\) and \(x_{max}\) determine the truncated date range.
Examples
# A sinewave with a period of 700 years
x <- seq(1500,4500, length.out=1000)
y <- sinewavePDF(x, min=2000, max=4000, f=1/700, p=0, r=0.2)
plot(x,y,type='l')