Learn R Programming

ADMUR (version 1.0.3)

sinewavePDF: 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, 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(2 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:

1 + (2 f x + p) - (r)(x_max - x_min)(1 - (r)) + (12 f)[(2 f x_min - p) - (2 f x_max - p)] where x = years, and x_min and x_max determine the truncated date range.

Examples

Run this code
# NOT RUN {
	# 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')
	
# }

Run the code above in your browser using DataLab