sphere.hdr | R Documentation |
This function computes HDRs of a spherical density and general level sets for real-valued functions defined on the unit sphere.
sphere.hdr(f,tau=NULL,level=NULL,nborder=1000,tol=0.1, mesh=40,deg=6,plot.hdr=TRUE,col=NULL)
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 |
nborder |
Maximum number of HDRs boundary points to be represented. Default |
tol |
Tolerance parameter to determinate the boundary of HDRs. Default |
mesh |
A numeric value 10, 20 or 40 indicating the 3D cartesian mesh used for numerical integration on the unit shere. Default |
deg |
Integer string indicating the degree (from 0 to 6) of the quadrature rules for triangles on the sphere for numerical integration. Default |
plot.hdr |
Logical string. If |
col |
Color number for plotting the boundary of the HDR. Default |
A detailed definition of directional HDRs for a density is given in Saavedra-Nieves and Crujeiras (2021). Note that numerical integration on the sphere is used to compute the threshold of HDR when tau
is provided.
If tau
is provided, a list with the next components:
hdr |
A matrix of rows of points on the HDR boundary. |
prob.content |
Probability coverage |
level |
Threshold associated to the probability content |
If level
is provided, a list with the next components:
levelset |
A matrix of rows of points on the level set boundary. |
level |
Threshold of the level set. |
Paula Saavedra-Nieves, Rosa M. Crujeiras and Andrés Prieto.
Saavedra-Nieves, P. and Crujeiras, R. M. (2021). Nonparametric estimation of directional highest density regions. Advances in Data Analysis and Classification, 1-36.
#HDR of model 8 in library HDiR f1<-function(x){return(dspheremix(x,model=8))} sphere.hdr(f1,tau=0.5,mesh=20,deg=3) # Density level set plug-in reconstruction from a sample # of size 500 (model 8) by using a kernel density # estimator with uniform kernel library(DirStats) f2<-function(x){ set.seed(1) sample<-rspheremix(500, model = 3) return(kde_dir(x, data = sample, h = 0.4, L = function(x) dunif(x))) } sphere.hdr(f2,level=0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.