circ.dens: circular density

View source: R/osciTools.R

circ.densR Documentation

circular density

Description

calculates kernel density estimates for circular data (‘phase angles’). It is a convenience wrapper around the density.circular function from package circular that (a) coerces results to numeric types to avoid automatic handling of the S3 class circular data (eg. polar plots), (b) allows to scale densities by the absolute number (argument freq), and (c) can alternatively invoke density from the stats package (see option high.mem) for long phase vectors (‘genome-wide’) due to high memory usage of density.circular. NOTE: results are equivalent only for the scaled version freq=TRUE; TODO: find out why densities differ by a factor of ~100 between the 2

Usage

circ.dens(
  x,
  bw = 18,
  n = 512,
  freq = FALSE,
  units = "degrees",
  high.mem = FALSE,
  na.rm = TRUE,
  ...
)

Arguments

x

phases in degrees and of class numeric

bw

the smoothing bandwith parameter

n

the number of equally spaced points at which density will be estimated

freq

if TRUE densities y will be scaled by the total number of measurement N as N * y/sum(y); the resulting density function will integrate to N

units

phase angle units, 'degrees' or 'radians'

high.mem

use density to calculate kernel densities, based on copying data from -360 to 0 and 360 to 720 degrees

na.rm

remove NA values before calculation

...

further arguments to density.circular or density

See Also

density.circular, density


raim/segmenTools documentation built on April 25, 2024, 10:14 a.m.