densityFit: Fits von Mises kernel density to time-of-day data.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/densityFit.R

Description

Fits von Mises kernel density to time-of-day data. Intended primarily for internal use: input checking is minimal.

Usage

1
densityFit(x, grid, bw)

Arguments

x

a vector of times of observations in radians, ie. scaled to [0, 2π].

grid

a vector of times in radians for which the density is required. This could be a vector of equidistant values in [0, 2π], eg. seq(0, 2*pi, length=128), or it could be any set of times for which a density is needed.

bw

bandwidth, the concentration parameter for the von Mises kernel: smaller values result in smoother curves.

Value

Returns a vector of densities corresponding to the times in grid.

Author(s)

C code written by Mike Meredith.

See Also

getBandWidth for appropriate bandwidth.

Examples

1
2
3
4
5
6
# Get example data:
data(simulatedData)

densityFit(tigerObs, c(0, pi/2, pi, 3*pi/2, 2*pi), 50)
# Densities at 6am and 6pm are fairly high, at midnight and midday, tiny.
# A crepuscular species!

Example output

[1] 0.02250011 0.45894441 0.02804782 0.54761611 0.02250011

overlap documentation built on May 17, 2021, 9:09 a.m.