r_g_kern: Sample from the angular kernel density

View source: R/kernels.R

r_g_kernR Documentation

Sample from the angular kernel density

Description

Simulation from the angular density function of an isotropic kernel on the sphere \mathcal{S}^d.

Usage

r_g_kern(n, d, h, kernel = "1", k = 10)

Arguments

n

sample size.

d

vector of size r with dimensions.

h

vector of size r with bandwidths.

kernel

kernel employed: 1 for von Mises–Fisher (default); 2 for Epanechnikov; 3 for softplus.

k

softplus kernel parameter. Defaults to 10.0.

Value

A vector of size n with the sample.

Examples

hist(r_g_kern(n = 1e3, d = 2, h = 1, kernel = "1"), breaks = 30,
     probability = TRUE, main = "", xlim = c(-1, 1))
hist(r_g_kern(n = 1e3, d = 2, h = 1, kernel = "2"), breaks = 30,
     probability = TRUE, main = "", xlim = c(-1, 1))
hist(r_g_kern(n = 1e3, d = 2, h = 1, kernel = "3"), breaks = 30,
     probability = TRUE, main = "", xlim = c(-1, 1))

polykde documentation built on April 16, 2025, 1:11 a.m.