CircNNTSR-package {CircNNTSR}R Documentation

CircNNTSR: An R Package for the statistical analysis of circular data using nonnegative trigonometric sums (NNTS) models


A collection of utilities for the statistical analysis of circular and spherical data using nonnegative trigonometric sum (NNTS) models


Package: CircNNTSR
Type: Package
Version: 2.2-1
Date: 2020-02-16
License: GLP (>=2)
LazyLoad: yes

Fernandez-Duran, J.J. (2004) proposed a new family of distributions for circular random variables based on nonnegative trigonometric sums. This package provides functions for working with circular distributions based on nonnegative trigonometric sums, including functions for estimating the parameters and plotting the densities.

The distribution function in this package is a circular distribution based on nonnegative trigonometric sums (Fernandez-Duran, 2004). Fejer (1915) expressed a univariate nonnegative trigonometric (Fourier) sum (series), for a variable theta, as the squared modulus of a sum of complex numbers, i.e.,

||sum_{k=0}^M c_k*exp{i*k*theta}||^2 (1)

where i=sqrt(-1). From this result, the parameters (a_k,b_k) for k=1,…, M of the trigonometric sum of order M,T(theta),

T(theta)=a_0 + sum_{k=1}^M(a_k*cos(k*theta) + b_k*sin(k*theta))

are expressed in terms of the complex parameters in Equation 1 , c_k, for k=0,…, M, as a_k - i*b_k= 2*sum_{ν=0}^{n-k}c_{nu + k}*\overline{c}_{ν}. The additional constraint, sum_{k=0}^n||c_k||^2=1/(2*pi)=a_0, is imposed to make the trigonometric sum to integrate one. Thus, c_0 must be real and positive, and there are 2*M free parameters. Then, the probability density function for a circular (angular) random variable is defined as (Fernandez-Duran, 2004)

f(theta; \underline{a},\underline{b},M)=1/(2*pi) + 1/pi*sum_{k=1}^M(a_k*cos(k*theta) + b_k*sin(k*theta)).

Note that Equation 1 can also be expressed as a double sum as


The underline{c} parameters can also be expressed in polar coordinates as c_k=rho_k*exp(i*phi_k) for rho_k >= 0 and phi_k en [0,2*pi); where rho_k is the modulus of c_k and phi_k is the argument of c_k for k=1,…,M. Many functions of the packages use as parameters the squared moduli and the arguments of c_k, rho_k^2 and phi_k, for k=1,…,M. We refer to the parameter M as the number of components in the NNTS.


Juan Jose Fernandez-Duran and Maria Mercedes Gregorio-Dominguez

Maintainer: Maria Mercedes Gregorio Dominguez <>


Fernandez-Duran, J.J. (2004). Circular Distributions Based on Nonnegative Trigonometric Sums, Biometrics, 60(2), 499-503.

Fernandez-Duran, J.J., Gregorio-Dominguez, M.M. (2010). A Likelihood-Ratio Test for Homogeneity in Circular Data. Journal of Biometrics & Biostatistics, 1(3), 107. doi:10.4172/2155-6180.1000107

Fernandez-Duran, J.J., Gregorio-Dominguez, M.M. (2010). Maximum Likelihood Estimation of Nonnegative Trigonometric Sums Models Using a Newton-Like Algorithm on Manifolds. Electronic Journal of Statistics, 4, 1402-1410. doi:10.1214/10-ejs587

Fernandez-Duran, J.J., Gregorio-Dominguez, M.M. (2014). Distributions for Spherical Data Based on Nonnegative Trigonometric Sums. Statistical Papers, 55(4), 983-1000. doi:10.1007/s00362-013-0547-5

Fernandez-Duran, J.J., Gregorio-Dominguez, M.M. (2014). Modeling Angles in Proteins and Circular Genomes Using Multivariate Angular Distributions Based on Nonnegative Trigonometric Sums. Statistical Applications in Genetics and Molecular Biology, 13(1), 1-18. doi:10.1515/sagmb-2012-0012

Fernandez-Duran, J.J., Gregorio-Dominguez, M.M. (2014). Testing for Seasonality Using Circular Distributions Based on Nonnegative Trigonometric Sums as Alternative Hypotheses. Statistical Methods in Medical Research, 23(3), 279-292. doi:10.1177/0962280211411531.

Juan Jose Fernandez-Duran, Maria Mercedes Gregorio-Dominguez (2016). CircNNTSR: An R Package for the Statistical Analysis of Circular, Multivariate Circular, and Spherical Data Using Nonnegative Trigonometric Sums. Journal of Statistical Software, 70(6), 1-19. doi:10.18637/jss.v070.i06


#Empirical analysis of data
#Estimation of the NNTS density with 3 componentes for data
#plot the estimated density
#add the histogram to the estimated density plot
plot(Turtles_hist, freq=FALSE, add=TRUE)


mnntsplot(cest, M)

[Package CircNNTSR version 2.2-1 Index]