cosine.expansion: Cosine expansion terms

View source: R/cosine.expansion.R

cosine.expansionR Documentation

Cosine expansion terms

Description

Computes the cosine expansion terms that modify the shape of distance likelihood functions.

Usage

cosine.expansion(x, expansions)

Arguments

x

A numeric matrix of distances at which to evaluate the expansion series. For distance analysis, x should be the proportion of the maximum sighting distance at which a group was sighted, i.e., x = d/w, where d is sighting distance and w is maximum sighting distance.

expansions

A scalar specifying the number of expansion terms to compute. Must be one of the integers 1, 2, 3, 4, or 5.

Details

The cosine expansion used here is:

  • First term:

    h_1(x)=\cos(2\pi x),

  • Second term:

    h_2(x)=\cos(4\pi x),

  • Third term:

    h_3(x)=\cos(6\pi x),

  • Fourth term:

    h_4(x)=\cos(8\pi x),

  • Fifth term:

    h_5(x)=\cos(10\pi x),

The maximum number of expansion terms is 5.

The cosine expansion frequency in Rdistance is 2*pi. Each term is two pi more than the previous. The sine expansion frequency in Rdistance is pi. Consequently, the sine and cosine expansions fit different models.

Value

A 3D array of size nrow(x) X ncol(x) X expansions. The 'pages' (3rd dimension) of this array are the cosine expansions of x. i.e., page 1 is the first expansion term of x, page 2 is the second expansion term of x, etc.

See Also

dfuncEstim, hermite.expansion, simple.expansion

Examples

x <- matrix(seq(0, 1, length = 200), ncol = 1)
cos.expn <- cosine.expansion(x, 5)
plot(range(x), range(cos.expn), type="n")
matlines(x, cos.expn[,1,1:5], col=rainbow(5), lty = 1)


Rdistance documentation built on Jan. 10, 2026, 1:07 a.m.