Package 'pgKDEsphere'

Title: Parametrically Guided Kernel Density Estimator for Spherical Data
Description: Nonparametric density estimation for (hyper)spherical data by means of a parametrically guided kernel estimator (adaptation of the method of Hjort and Glad (1995) <doi:10.1214/aos/1176324627> to the spherical setting). The package also allows the data-driven selection of the smoothing parameter and the representation of the estimated density for circular and spherical data. Estimators of the density without guide can also be obtained.
Authors: María Alonso-Pena [aut, cre], Gerda Claeskens [aut], Irène Gijbels [aut]
Maintainer: María Alonso-Pena <[email protected]>
License: GPL (>= 2)
Version: 1.0.1
Built: 2024-11-04 06:44:30 UTC
Source: CRAN

Help Index


pi.kappa

Description

Function pi.kappa computes a plug-in type smoothing parameter for the parametrically guided (hyper)spherical kernel density estimator, equipped with a von Mises-Fisher guide.

Usage

pi.kappa(datax, mu0, tau0, guide = TRUE)

Arguments

datax

Matrix containing the data in cartesian coordinates, where the number of rows is the number of observations and the number of columns is the dimension of the Euclidean space where the sphere is embebed.

mu0

Vector containing the mean direction of the von Mises-Fisher guide.

tau0

Numerical value containing the concentration of the von Mises-Fisher guide.

guide

Logical; if TRUE, the estimator with a von Mises-Fisher as guide is computed. If FALSE, the classical kernel density estimator without guide is computed (equivalent to uniform guide).

Details

See Alonso-Pena et al. (2023) for details.

Value

A numerical value with the selected data-driven smoothing parameter.

References

Alonso-Pena, M., Claeskens, G. and Gijbels, I. (2023) Nonparametric estimation of densities on the hypersphere using a parametric guide. Under review.

Examples

library(Directional)
library(movMF)
# Data generation
n<-200
mu<-matrix(c(0,0,1,0,0,-1),ncol=3,byrow=TRUE)
k<-c(7,2)
probs<-c(0.85,0.15)
datax<-rmovMF(n,k*mu,alpha=probs)
# Estimation of parameters of a vMF
param<-vmf.mle(datax)
mu0<-param$mu
tau0<-param$kappa
# Selection of the smoothing parameter
kappa <- pi.kappa(datax,mu0,tau0)

sphkde.pg

Description

Function sphkde.pg computes the kernel density estimator for (hyper)spherical data with a parametric guide, which corresponds to the von Mises-Fisher model.

Usage

sphkde.pg(datax, kappa = NULL, eval.points = NULL, guide = TRUE)

Arguments

datax

Matrix containing the data in cartesian coordinates, where the number of rows is the number of observations and the number of columns is the dimension of the Euclidean space where the sphere is embebed.

kappa

Smoothing parameter. It refers to the concentration when employing a von Mises-Fisher kernel.

eval.points

Matrix containing the evaluation points for the estimation of the density.

guide

Logical; if TRUE, the estimator with a von Mises-Fisher as guide is computed. If FALSE, the classical kernel density estimator without guide is computed (equivalent to uniform guide).

Details

See Alonso-Pena et al. (2023) for details.

Value

An object with class "sphkde" whose underlying structure is a list containing the following components:

estim

The estimated values of the density.

kappa

The smoothing parameter used.

data

The n coordinates of the points where the regression is estimated.

eval.points

The points where the estimated density was evaluated.

data

Original dataset.

References

Alonso-Pena, M., Claeskens, G. and Gijbels, I. (2023) Nonparametric estimation of densities on the hypersphere using a parametric guide. Under review.

Examples

library(movMF)
n<-200
mu<-matrix(c(0,0,1,0,0,-1),ncol=3,byrow=TRUE)
k<-c(7,2)
probs<-c(0.85,0.15)
datax<-rmovMF(n,k*mu,alpha=probs)
est<-sphkde.pg(datax,guide=TRUE)
sphkde.plot(est,type="sph")

sphkde.plot

Description

Function sphkde.plot provides a graphical representation of the parametrically guided kernel density estimator for spherical and circular data. For circular data, both linear and circular representations are available. For spherical data, an interactive 3D spherical representation is provided.

Usage

sphkde.plot(object, type = "sph", axis = TRUE, shrink = 1.2)

Arguments

object

Object of the class sphkde.

type

Character string giving the desired type of plot. For circular data, it can be "sph" for a circular representation or "line" for a linear representation. For spherical data the value "sph" is required.

axis

Logical; if TRUE, the axis are represented in the spherical representation. If FALSE, axis are not represented. Only for spherical representations.

shrink

Numeric parameter that controls the size of the plotted circle in the circular representations. Default is 1.3. Larger values shrink the circle, while smaller values enlarge the circle.

Details

See Alonso-Pena et al. (2023) for details.

Value

sphkde.plot is called for the side effect of drawing the plot.

References

Alonso-Pena, M., Claeskens, G. and Gijbels, I. (2023) Nonparametric estimation of densities on the hypersphere using a parametric guide. Under review.

Examples

library(movMF)
n<-200
mu<-matrix(c(0,0,1,0,0,-1),ncol=3,byrow=TRUE)
k<-c(7,2)
probs<-c(0.85,0.15)
datax<-rmovMF(n,k*mu,alpha=probs)
est<-sphkde.pg(datax,guide=TRUE)
sphkde.plot(est,type="sph")