Computes the estimator of the modes of a circular variable based on a kernel density estimator. The estimation is performed numerically through the circular mean shift algorithm.
circ.modes(x,bw.modes=NULL,bw.dens=NULL,plot=TRUE,col.modes=2,col.dens=1,lwd.modes=2,
lwd.dens=2,tol=0.0000000000001, labels=NULL, control.circular = list())A list with the following components:
The input data.
Numeric vector containing the estimated mode locations (in the same units as the input data).
Smoothing parameter used for mode estimation.
Smoothing parameter used for density estimation.
Data from which the modes are to be estimated. The object is coerced to class circular.
Smoothing parameter for the von Mises kernel for the estimation of the modes. If null, bw.AA with the option deriv=1 is used.
Smoothing parameter for the von Mises kernel for the estimation of the density. If null, bw.AA with the option deriv=0 is used. Only used if plot = TRUE.
Logical; if TRUE, a plot of the estimated density and detected modes is produced.
Color for the mode lines. Can be specified as a character string (color name or hexadecimal code) or as a numeric index. Only used if plot = TRUE.
Color for the density curve. Can be specified as a character string (color name or hexadecimal code) or as a numeric index. Only used if plot = TRUE.
Line width for the mode lines (see graphical parameter lwd). Must be a positive numeric value. Only used if plot = TRUE.
Line width for the density curve (see graphical parameter lwd). Must be a positive numeric value. Only used if plot = TRUE.
Numeric tolerance used in the mode estimation algorithm to determine convergence. Smaller values yield more precise but potentially slower computations.
Logical; if TRUE, angular reference labels are added to the plot.
A list of control parameters passed to circular::circular to define properties such as units, zero direction, and rotation.
Maria Alonso-Pena
The function performs nonparametric density estimation for circular or axial data using kernel methods and identifies modes of the estimated density. Mode detection is carried out through an iterative procedure that searches for local maxima of the smoothed density function.
The number and location of the detected modes depend on the smoothing parameter used in the density estimation. In particular, larger bandwidth values produce smoother densities with fewer modes, whereas smaller bandwidth values may reveal additional local features. If bw=NULL, the bandwidth is selected as a plug-in of the optimal bandwidth for the estimation of the first derivative.
When plot = TRUE, the estimated density curve and the detected modes are displayed. Graphical parameters such as colors and line widths can be customized through the corresponding arguments.
Alonso-Pena, M., Aerden, D.G.A.M. and Angulo, J.M. (2026). Quantifying tectonic relevance of porphyroblast inclusion trails: axial mode estimation and clustering.
# axial data in degrees, geographics template
set.seed(1)
x<-c(rvonmises(100,pi/8,10),rvonmises(100,pi,5))
x<-conversion.circular(x/2,units="degrees",template="geographics",modulo="pi")
plot(x,stack=TRUE)
points(x+180,stack=TRUE,col="grey")
circ.modes(x,col.modes=3,col.dens="blue",lwd.dens=3,lwd.modes=3)
Run the code above in your browser using DataLab