circ.hdr {HDiR}R Documentation

Computation of HDRs for a circular density and of general level sets for circular real-valued functions

Description

This function computes HDRs for a circular density and general level sets for real-valued functions defined on the unit circle.

Usage

circ.hdr(f,tau=NULL,level=NULL,plot.hdr=TRUE,col=NULL,
         lty=NULL,shrink=NULL,cex=NULL,pch=NULL)

Arguments

f

Object of class "function" that represents a circular density function or any general real-valued function defined on the unit circle. Vector parametrisation of function f on a vector of angles with values between 0 and 2\pi must be established. Additionally, if f is not a density function, the argument tau cannot be specified and only the value of level must be provided by the user.

tau

Numeric probability. According to Saavedra-Nieves and Crujeiras (2021), 1-tau represents the probability coverage required for HDR. If tau=NULL, a value for the threshold level must be provided.

level

Numeric threshold of the HDR or of the general level set provided by the user. If level is larger than the maximum value of the function f, the HDR or the level set are equal to the emptyset. If level is smaller than the minimum of f, its support is obtained. If level=NULL, f must be a density function and a value for the probability coverage 1-tau of the HDR must be provided.

plot.hdr

Logical string. If TRUE, the circular density and the level set or the HDR are represented graphically. Default plot.density=TRUE.

col

Color for plotting the HDR. Default col="darkgray" is used.

lty

A numeric value indicating the line type to represent the threshold of HDR. Line type can be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash). Default lty=2.

shrink

Parameter that controls the size of the plotted circle. Default is 2. Larger than 1 values shrink the circle, while smaller values enlarge the circle.

cex

Point character size for representing the data on the scatterplot. Default is 0.5.

pch

Plotting character. Default 19.

Details

A detailed definition of HDRs for circular and spherical densities is given in Saavedra-Nieves and Crujeiras (2021). Trapezoidal rule is used to compute the threshold of HDR when tau is provided.

Value

If tau is provided, a list with the next components:

hdr

Boundaries of the HDR.

prob.content

Probability coverage 1-tau.

level

Threshold of the HDR associated to the probability content 1-tau.

If level is provided, a list with the next components:

levelset

Boundaries of the level set or a character indicating if the level set is equal to the emptyset or the support distribution.

level

Threshold of the level set.

Author(s)

Paula Saavedra-Nieves and Rosa M. Crujeiras.

References

Saavedra-Nieves, P. and Crujeiras, R. M. (2021). Nonparametric estimation of directional highest density regions. Advances in Data Analysis and Classification, 1-36.

Examples

# HDRs of model 11 in library NPCirc
library(NPCirc)
f1<-function(x){return(dcircmix(x,11))}
circ.hdr(f1,tau=0.2,shrink=1.5)
circ.hdr(f1,tau=0.8,shrink=1.5)

# Plug-in level set estimation for regression
# with circular (x) - linear (y) data by using
# the Nadaraya-Watson estimator
f2<-function(t){
  set.seed(1012)
  n <- 100
  x <- runif(n, 0, 2*pi)
  y <- sin(x)+0.5*rnorm(n)
  return(kern.reg.circ.lin(circular(x),y,t,bw=10,method="NW")$y)
}
circ.hdr(f2,level=.5,plot.hdr=FALSE)


[Package HDiR version 1.1.3 Index]