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 |
tau |
Numeric probability. According to Saavedra-Nieves and Crujeiras (2021), |
level |
Numeric threshold of the HDR or of the general level set provided by the user. If |
plot.hdr |
Logical string. If |
col |
Color for plotting the HDR. Default |
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 |
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 |
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 |
level |
Threshold of the HDR associated to the probability content |
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)