Mar 31, 2018 - ture is worth a thousand words. ... Keywords: Directional data in 3-dimensions; Fisher and Bingham ...... I. Robert E. Krieger Publishing Co.
Simulation and Visualization of Spherical Distributions Gy. H. Terdik
∗
Faculty of Informatics, University of Debrecen, 4029 Debrecen, Hungary and S. Rao Jammalamadaka Department of Statistics and Applied Probability, University of California, Santa Barbara, CA 93106, USA and B. Wainwright Department of Statistics and Applied Probability, University of California, Santa Barbara, CA 93106,USA March 31, 2018
Abstract In a recent paper, Harmonic analysis and distribution-free inference for spherical distributions Rao Jammalamadaka and Terdik [2017], the first two authors considered new models ∗
This work was supported in part by the project EFOP-3.6.2-16-2017-00015. The project has been supported by the European Union, co-financed by the European Social Fund.
1
and inference for directional data in 3-dimensions. In this paper, we consider the simulation, visualization, and fitting of such spherical distributions, in support of the dictum, “A picture is worth a thousand words.” We provide computational algorithms to simulate several spherical models, and in selected cases, also provide alternate and improved algorithms for some existing models so that a user can compare alternate approaches for generating such random variates. The MATLAB scripts of figures, the algorithms contained in the paper are made available as well as a MATLAB package titled “3D-Directional Statistics, Simulation and Visualization” (3D-Directional-SSV) in Supplementary Material.
Keywords: Directional data in 3-dimensions; Fisher and Bingham distributions; Dimroth-Watson distribution; spherical harmonics; simulation of densities on sphere S2 , histogram on S2 ; MATLAB code.
2
1
Introduction
Vector space representation provides a very efficient method for displaying and analyzing spherical data, both in the natural world as well as for the theoretical framework. Further practical exploration and analysis in this area depends on related software and associated algorithms. We consider spherical distributions on the surface of the unit sphere S2 embedded in R3 , with the aim of validating and testing the theory presented in Rao Jammalamadaka and Terdik [2017], as well as in related papers by others on this topic. We develop the necessary computational tools to achieve this goal, and produce what we believe will be a valuable resource for scientists interested in statistical analysis of directional data in 3-dimensions. These tools are provided in the form of a MATLAB package titled “3D-Directional Statistics, Simulation, and Visualization (3D-Directional-SSV)”. We start with a summary of what we call the Generalized Fisher-Bingham (GFB) family of distributions, and point out the structure and relationship between various subfamilies therein. We review and reconsider earlier work by Wood [1987], Kent [1982], and a more recent R-package by Kent et al. [2017] for the simulation of selected distributions belonging to this GFB family. Our MATLAB package 3D-Directional-SSV makes appropriate modifications needed for our specific context, taking advantage of recent developments in software routines. The main impetus for this computational exploration is in support of the theoretical work developed in Rao Jammalamadaka and Terdik [2017] – from now on, abbreviated as [JT17], in the rest of this paper. Besides covering the entire GFB family of distributions, our work provides visualization and simulation tools for new spherical distributions characterized by their spherical harmonics as discussed there. The potential research applications and uses of this software are unlimited and yet to be fully explored. Such visualization of spherical models and plotting of densities and histograms is made possible on the surface of the unit sphere in high relief, as opposed to the more typical heatmap representation. The topographical composition of the plots (density, simulated data, and
3
histogram) provides a much clearer graphical representation. In Section 2, a brief account of the GFB family of distributions is given, along with a schematic diagram of the relationships between GFB subfamilies. We then describe the inter-relationships for the various subfamilies and the background theory needed for later simulations. Section 3 describes how a histogram for a random sample of observations on the unit sphere S2 , may be plotted. Section 4 includes various algorithms for the simulations and visualization, along with some needed explanations. We provide as Supplementary material to this paper, a comprehensive MATLAB package which contains: (i) MATLAB scripts for Figures and the Algorithms contained in the paper (ii)A MATLAB package, called “3D-Directional-SSV” containing various MATLAB scripts for generating different spherical models described in this paper, as well as tools for implementing other manipulations on spherical data such as plotting, etc.
2
GFB family of distributions
Let e (ϑ, ϕ) = (sin ϑ cos ϕ, sin ϑ sin ϕ, cos ϑ)> , x e=x represent a point on the surface of the unit sphere S2 in R3 , with colatitude ϑ ∈ [0, π] and longitude ϕ ∈ [0, 2π]. We consider density functions f (e x) on such an S2 . We shall use 2 alternate notations for a density viz. f (e x) and f (ϑ, ϕ), the main difference between them being that f (e x) corresponds to the measure Ω (de x) = sin ϑdϑdϕ, while f (ϑ, ϕ) includes sin ϑ in it, and corresponds to the measure dϑdϕ on the set (ϑ, ϕ) ∈ [0, π] × [0, 2π]. For instance, if X is a random unit vector which is distributed uniformly on S2 (see Mardia and Jupp [2009], Section 9.3.1), then the Uniform density f (e x) = 1/4π, x e ∈ S2 is constant, while at the same time, in terms of the coordinates (Θ, Φ), the probability density becomes
f (ϑ, ϕ) =
4
1 sin ϑ, 4π
so that Θ and Φ are independent, with Θ distributed as (sin ϑ) /2 on [0, π] and Φ is uniform on [0, 2π]. A consequence of this dual representation, to the simulation of random variates on the unit sphere S2 is the following. One may simulate a random variate (Θ, Φ) according to the density f (ϑ, ϕ) and then use x e (Θ, Φ) = (sin Θ cos Φ, sin Θ sin Φ, cos Θ)> for a random point on S2 , or e ∈ S2 according to the density f (e simulate directly a random variate X x). A distribution is considered uni-, bi-, and multi-modal, if it has one, two, or more modes. In case there are two modes which are opposite, i.e. there is an axis joining the two modes, we call this distribution bipolar. If the mass is concentrated around the main circle, it will be called a girdle distribution. Examples that follow, will make these notions clear. We start with a very general family of spherical distributions, labelled the “Generalized FisherBingham Family” (GFB) containing 8 parameters, viz. GFB8 , given by the density (Bingham [1974]), e0 , κ, A ∼ e> Ae x , µ0 · x e+x f8 x e; µ = exp κe
(1)
where ∼ e0 ∈ S2 , A is a symmetric = denotes equality up to a multiplicative constant and where µ 3 × 3 matrix and µ e0 · x e denotes the usual inner product. Matrix A has the form A = M ZM > , h i where M = µ e1 , µ e2 , µ e3 is an orthogonal matrix and Z = diag (ζ1 , ζ2 , ζ3 ) is a diagonal matrix. One of the earliest and commonly used models for spherical data is the (unimodal) von MisesFisher distribution (Fisher [1953]) which can be extended to an antipodally symmetric model, as given by the Dimroth (Dimroth [1962]) and Watson (Watson [1965]). Such antipodally symmetric models were further generalized by Bingham (Bingham [1974]), and these models, belonging to a particular set of exponential type distributions, shall be called the GFB family. It has several subfamilies according to the number of parameters, the Figure 1 shows a Diagram of Relationships between GFB Families of Distributions. Letting ζ be an arbitrary constant, we can show that changing the matrix A to A1 = M Z1 M >
5
Figure 1: Relationships Between GFB Family of Distributions in (1), where Z1 = diag (ζ1 − ζ, ζ2 − ζ, ζ3 − ζ) ,
(2)
the density (1) will not change. To avoid identifiability problems it is necessary to impose some constraints. Setting ζ = (ζ1 + ζ2 + ζ3 ) /3, one usually assumes that
tr (A) = ζ1 + ζ2 + ζ3 = 0.
(3)
Under this assumption ζ3 = −ζ1 − ζ2 , i.e. Z is given by two parameters ζ1 and ζ2 . The unique set of parameters of the density (1) has a cardinality of 8. These are 1. the parameter κ, 2. two angles (ϑµ , ϕµ ), which define µ e0 = (sin ϑµ cos ϕµ , sin ϑµ sin ϕµ , cos ϑµ )> , 3. two eigenvalues ζ1 , ζ2 , of A, and 4. three Euler angles which define the orthogonal matrix M , considered as a rotation matrix. Using the terminology as in Kent [1982], this is the GFB8 model, and has the density (1) of
6
the form,
µ0 · x e+ e0 , κ, ζ1 , ζ2 , M ∼ f8 x e; µ = exp κe
3 X
ζk
! 2 e . µ ek · x
k=1
If we set ζ = (ζ1 + ζ2 ) /2 in (2), an equivalent form of (1) can be derived such that the density is given by,
f8
2 2 2 x e; κ, β, γ, µ . e0 , M ∼ µ0 · x e+γ µ e3 · x e +β µ e1 · x e − µ e2 · x e = exp κe
(4)
In this paper, we shall consider densities of the form (4). In this form, the set of parameters κ, β, and γ satisfy the following: Condition 2.1. The parameters of the density (4) fulfill: κ ∈ R, β ≥ 0, γ ∈ R. Remark 1. Notice, we allow for κ ∈ R, however a sign change of κ is equivalent to changing either µ e0 to −e x, since the quadratic form in the density (4) is invariant under transformation µ0 , or x e to −e x e to −e x. The sign change of κ will interchange hemispheres only, therefore modulus |κ|, in some cases, can be considered as the parameter of concentration. If κ ≤ 0, then e0 , M = f8 −e e0 , M f8 x e; κ, β, γ, µ x; −κ, β, γ, µ µ0 , M . = f8 x e; −κ, β, γ, −e In terms of colatitude and longitude one can use the transformation ϑ → π − ϑ, and ϕ → ϕ + π, for getting x e → −e x. We mention the GFB8 distribution here for completeness, but in practice we will make use of convenient restrictions, discussed in the next section, which will allow us to reduce the number of parameters without loss of generality or flexibility.
7
2.1
Model GFB6
e3 , or by assuming µ e0 is collinear to We apply a restriction on the GFB8 by setting either µ e0 = µ µ e3 in (4). In this way, we can reduce the number of parameters by two i.e. by the two angles (ϑµ0 , ϕµ0 ), which define µ e0 . The resulting GFB6 model has a density given by, 2 2 2 ∼ f6 (e x; κ, β, γ, M ) = exp κe µ3 · x e+γ µ e3 · x e +β µ e1 · x e − µ e2 · x e .
(5)
We can split up the rotation, which transforms the original xyz system into the orthogonal h i system defined by M = µ e1 , µ e2 , µ e3 , into two separate rotations. The first rotation, Gµe ,Ne , will 3
e = (0, 0, 1)> to µ e3 , i.e. Gµe rotate the North pole N
3
e e3 . The rotation Gµe eN = µ ,N
3
e ,N
can be
e and µ e× constructed in the following way. The vectors N e3 define a plane with normal vector N e× µ e to µ e3 be the axis of rotation and rotate N e3 . This rotation µ e3 (cross product). Now, let N depends solely on µ e3 , i.e. by the two angles ϑµ and ϕµ of µ e3 . When we rotate the sphere by Gµe
3
e, ,N
e2 , since µ e3 is now the plane of rotated x− and y− axes coincides with the plane defined by µ e1 and µ perpendicular to both planes. Next, using µ e3 as the axis of rotation, we rotate the sphere by an angle ψ ∈ [0, 2π] such that µ e1 coincides with the rotated x-axis, and µ e2 coincides with the rotated y-axis. Let this rotation be denoted by Gµe1,2 ,xy . These three angles ϑµ , ϕµ and ψ, called Euler angles, characterize the rotation from the original orthogonal system to the orthogonal system i h e2 , µ e3 . M= µ e1 , µ Note here that the rotations from one system to another one are not unique and during simulations we shall apply the above rotation for the densities, their simulations, and histograms. The six parameters of Model GFB6 are then κ, β, γ and M . If µ e3 is known we can apply Gµe
3
e ,N
e and (5) will have the form and rotate it to the North pole N
f6
2 2 1 1 2 ∼ e x e; κ, β, γ, N , ψ = exp κe x3 + γe x3 + β µ e1 · x e − µ e2 · x e ,
where again, x e = (e x1 , x e2 , x e3 ), and µ e1k are the transformed µ ek , by Gµe 8
3
e. ,N
Applying Gµe1,2 ,xy , the
density in the new coordinate system is 2 2 2 2 2 e, 0 ∼ f6 x e; κ, β, γ, N = eκex3 +γex3 +β (xe1 −ex2 ) = eκ cos ϑ+γ cos ϑ+β sin ϑ cos 2ϕ . e and ψ = 0, we introduce the notation For simplicity, if µ e3 = N e , f6 (e x; κ, β, γ) = f6 x e; κ, β, γ, 0, N and call it the canonical form. The mean direction µ e of the model GFB6 , given by (5), is characterized by a constant times e , in particular if κ = 0, then µ κM > N e is undefined (e µ = 0, see [JT17] for details). e if and only if β = 0 ([JT17]). Remark 2. The Model GFB6 is rotational symmetric with axis N An example of rotational symmetry of GFB6 , when β 6= 0, is given in Remark 5, where the axis of rotation is the y−axis. From now on we consider densities in the canonical form and simulate random variates when h i e and ψ = 0. If we are given a matrix of rotation M = µ e2 , µ e3 , then we apply this µ e3 = N e1 , µ rotation as the last step of the simulation. As we have seen above, this rotation can be given by e to µ µ e3 and angle ψ, such that we rotate N e3 , then use µ e3 as the axis of rotation and rotate the sphere by angle ψ. This is the reverse rotation from what we described above. Formally, we apply the product of the two rotations GNe ,eµ · Gxy,eµ1,2 . (The product of two rotations Gµe 3
3
e ,N
· Gµe1,2 ,xy is
again, a rotation.) Considering the density at transformation x = cos ϑ, as is done in Wood [1987],
x e1 =
√
1 − x2 cos ϕ, x e2 =
√ 1 − x2 sin ϕ, x e3 = x,
(6)
with the derivative −dx = sin ϑdϑ, we obtain what we will hereafter refer to as, the basic form of
9
the density f6 , given by, g6 (x, ϕ; κ, β, γ) ∼ = eκx+γx
2 +β
(1−x2 ) cos 2ϕ
2 2 = eβ (1−x ) cos 2ϕ eκx+γx .
(7)
This is the joint density in x and ϕ, and can be considered as the product of two densities, where exp (κx + γx2 ) is a density in x, and exp (β (1 − x2 ) cos 2ϕ) is the conditional density of Φ given X. More precisely g6 (x, ϕ; κ, β, γ) = gΦ|X (ϕ|x; β) g6,X (x; κ, γ) , where g6,X (x; κ, β, γ) ∼ = exp κx + γx2
Z
2π
2 2 eβ (1−x ) cos 2ϕ dϕ = I0 β 1 − x2 eκx+γx .
0
It follows from (7) that 2 gΦ|X (ϕ|x; β) ∼ = eβ (1−x ) cos 2ϕ .
(8)
The densities g6,X (x; κ, β, γ) and gΦ|X (ϕ|x; β) will be called the marginal density, and conditional density respectively. The conditional density gΦ|X remains the same throughout this paper, and therefore we do not refer to the specific subfamily to which it corresponds. Remark 3. When X = x is given, the conditional density (8) follows vMF distribution (see Section 2.6) with parameter β (1 − x2 ) and is a function of 2ϕ. It is worth mentioning that gΦ|X (ϕ|x; β) is not a vMF distribution on the unit sphere S2 since the sin 2ϕ component is missing from (8), but it is vMF distributed on the unit circle S1 . We now consider special cases of Model GFB6 , when one of the basic parameters κ, β, γ is zero. Although the densities in these cases follow directly from the densities f6 and g6 , we list them individually in order of decreasing complexity. The algorithms for the simulation of these models will be given in Section 4, in reverse order, incrementally increasing the number of parameters 10
and the model complexity.
2.2
Kent Model GFB5,K
Let γ = 0, in (5). Then, the number of parameters in f6 (e x; κ, β, γ, M ) is reduced by one (i.e. by parameter γ), and has the form 2 2 ∼ e+β e − µ e , f5 (e x; κ, β, M ) = exp κe µ3 · x µ e1 · x e2 · x
(9)
which defines the five parameter model GFB5,K . The five parameters are κ, β, and M , with canonical form 2 2 f5 (e x; κ, β) ∼ = eκex3 +β (xe1 −ex2 ) .
In terms of ϑ and ϕ f5 (e x; κ, β) ∼ = eκ cos ϑ+β sin
2
ϑ cos 2ϕ
,
(10)
see Wood [1987]. If we apply transformation (6) then the corresponding basic form is
g5 (x, ϕ; κ, β) = gΦ|X (ϕ|x; β) g5,X (x; κ) ,
where g5,X (x; κ, β) ∼ = I0 β 1 − x2
eκx ,
(11)
see (8) for conditional density gΦ|X . Furthermore, if 2β ≤ κ the distribution is unimodal with mode at µ e3 , which is the case Kent originally considered in Kent [1982]. If 2β > κ the distribution is bimodal, with modes at longitude ϕ = 0 and π, with the third coordinate, x e3 , defined by the equation cos ϑ = κ/2β for both modes. Remark 4. All MATLAB scripts described in this paper are listed in Supplement, and are contained in the package ‘3D-Directional Statistics, Simulation and Visualization’ (3D-DirectionalSSV). 11
Figure 2: Kent density, left: bimodal, 2β > κ, modes are at ϑ = π/4, and ϕ = 0, π; right: unimodal, 2β ≤ κ When 2β ≤ κ, the parameters in this model have the meaning (see Kent [1982]) 1. |κ| represents the concentration 2. µ e3 is the mean direction (pole or mode) 3. µ e1 and µ e2 are, respectively, the major and minor axes of constant probability ellipses near the mode, and are determined only up to sign.
2.2.1
Equal area projection and separability of FB6
Equal area projection of spherical densities provide some possibility of simulations on a rectangle in the plain. As mentioned in Kent and Hamelryck [2005], in the particular case when 2β ≤ κ, model GFB5,K represents Lambert’s equal area projection of the sphere
y1 = r cos ϕ, y2 = r sin ϕ, r = sin (ϑ/2) ,
12
(12)
and separates the density (10) by coordinates y1 and y2 . The inverse of this transform cos ϑ = 1 − 2 y12 + y22 ,
(13)
y2 sin ϕ = p 2 2 2 , y1 + y2 y2 cos ϕ = p 2 1 2 , y1 + y2 will be useful during simulations. The transformed Kent model FB5,K writes 2 4 2 4 f5 (y1 , y2 ; κ, ζ1 , ζ2 ) ∼ = e−2(κ−2β)y1 −4βy1 e−2(κ+2β)y2 +4βy2 ,
see the Proof of the Lemma below. Namely the transformed coordinates become independent. We show that the opposite of this statement is also true. Lemma 2.2. Consider the model FB6 with density given in the form x3 + f6 (e x; κ, ζ1 , ζ2 ) ∼ = exp κe
3 X
! ζk x e2k
.
(14)
k=1
The equal area projection f6 (y1 , y2 ; κ, ζ1 , ζ2 ) of (14) will be separable in y1 and y2 if only if f6 (y1 , y2 ; κ, ζ1 , ζ2 ) corresponds to the Kent model FB5,K . Proof. Let us start from the FB6 density x3 + f6 (e x; κ, ζ1 , ζ2 ) ∼ = exp κe
3 X k=1
13
! ζk x e2k
.
Now, apply the equal area projection (12). We have
x e3 = cos ϑ = 1 − 2r2 , x e21 = 4 1 − r2 y12 , x e22 = 4 1 − r2 y22 , x e23 = 1 − 4r2 1 − r2 hence f6 (y1 , y2 ; κ, ζ1 , ζ2 ) ∼ = exp −2κr2 + 4 1 − r2
ζ1 y12 + ζ2 y22 − ζ3 r2
,
(15)
where r2 = y12 + y22 . Now, the exponent in details writes − 2κ y12 + y22 + 4ζ1 y12 + ζ2 y22 − ζ3 y12 + y22 − 4ζ1 y14 + y12 y22 − 4ζ2 y24 + y12 y22 + 4ζ3 y14 + 2y12 y22 + y24 .
The density (15) will be separable in y1 and y2 iff
ζ1 + ζ2 − 2ζ3 = 0.
(16)
The sum ζ1 + ζ2 − 2ζ3 is invariant under the transformation (2), therefore setting ζ = (ζ1 + ζ2 ) /2, in (2), (16) implies and implied by γ = ζ3 − (ζ1 + ζ2 ) /2 = 0, in other words the model is the Kent model FB5,K .
2.3
Bingham Model GFB5,B
An alternate way of reducing the number of parameters in (5) by one, is setting κ = 0. This yields the density,with canonical form 2 2 2 2 2 fB (e x; β, γ) ∼ = eγex3 +β (xe1 −ex2 ) = eγ cos ϑ+β sin ϑ cos 2ϕ .
14
(17)
Figure 3: Bingham model; β = 3.2, for all cases, γ = −1.1 < β, γ = 3.2 = β and γ = 4.1 > β from left to right respectively, here µ e = (0, 0, 1)> , and ψ = 0. Application of transformation (6) gives the basic form
gB (x, ϕ; β, γ) = gΦ|X (ϕ|x; β) gB,X (x; γ) ,
where gB,X (x, β, γ) ∼ = I0 β 1 − x2
2
eγx ,
see (8) for conditional density gΦ|X . Here, the marginal density gB,X contains the expression exp (γx2 ) which corresponds to the DW distribution, defined in Equation (19)). Remark 5. In a particular case, when β = γ, the density (17) has the form 2 2 2 2 fB (e x; β, γ) ∼ = eγex3 +β (xe1 −ex2 ) ∼ = e−2γex2 ,
(18)
This model (18) is a rotation of the DW model (see Equation (19)) with negative parameter (we remind the reader that β > 0) and therefore (18) is a girdle distribution according to the main circle x e2 = 0. Let us fix β and change γ and consider three alignments: if γ < β, then it is bipolar with modal direction x−axis, if β = γ, then it is girdle, finally, if β < γ, then the modal direction is e , see Figure 3. the North pole N
15
2.4
Model GFB4,β
We now consider the simplest form when the conditional density gΦ|X is not constant, namely when the Θ and Φ are not independent random variables. Setting either κ = 0 and γ = 0 in (5), or κ = 0 in (9), or γ = 0 in (17), we get the density function which is a four-parameter family of distributions, with canonical form 2 2 2 fβ (e x; β) ∼ = eβ (xe1 −ex2 ) = eβ sin ϑ cos 2ϕ ,
The basic form 2 gβ (x, ϕ; β) ∼ = eβ (1−x ) cos 2ϕ ,
coincides formally with the conditional density gΦ|X . Nevertheless, the marginal density is not uniform, since gβ (x, ϕ; β) = gΦ|X (ϕ|x; β) gβ,X (x, β) , where gβ,X (x, β) ∼ = I0 β 1 − x2
,
and as we have already mentioned, gΦ|X follows vMF distribution on the circle see (8).
2.5
Model GFB4
Setting β = 0, in (5) we reduce the number of parameters by two (β, and angle ψ) the result in canonical form is 2 2 f4 (e x; κ, γ) ∼ = eκex3 +γex3 = eκ cos ϑ+γ cos ϑ .
This density does not depend on longitude ϕ. Instead, it depends only on cos ϑ and hence, is rotational symmetric (see Lemma 4 [JT17]).
16
Transformation (6) provides the basic form g4 (x; κ, γ) ∼ = eκx+γx . 2
A particular case of Model GFB4 when κ = 0, is the following three parameter family:
2.6
Dimroth-Watson Model GFB3,DW
The Dimroth-Watson Distribution (DW) Watson [1983] distribution is given by the density function, e = fW x e; γ, µ
2 1 1 2 eγ (µe·ex) = eγ cos ϑ , M (1/2, 3/2, γ) M (1/2, 3/2, γ)
(19)
where M (1/2, 3/2, γ) is Kummer’s function (not to be confused with the orthogonal matrix M e , [JT17]. Either setting γ = 0, in Model GFB4 , or described above) and where ϑ = arccos µ e·x β = 0, in the Kent Model GFB5,K , we arrive at the most basic model on the sphere viz. the von Mises-Fisher distribution.
Model GFB3,vM F
The widely used von Mises-Fisher Model (vMF) density is given by √
fvM F x e = e; κ, µ
(2π)
with basic form
√ gvM F (x; κ) =
3
3/2
3/2
(2π)
κ
I1/2 (κ)
κ
I1/2 (κ)
eκeµ·ex ,
(20)
eκx .
A Spherical Histogram
A histogram for a random sample on the unit sphere S2 assumes an equal-area discretization of the sphere. We consider the HEALPix (Hierarchical, Equal Area and iso Latitude Pixelization) discretization, a detailed description of which can be found in Gorski et al. [2005]. In the first step
17
Figure 4: Uniform sample and its Histogram of the pixelization the sphere is partitioned into 12 equal-area spherical quadrilaterals (pixels), and in each subsequent step, all the existing pixels are divided into 4 equal-area quadrilaterals. HEALPix is a discretization with the resolution parameter nside (number of steps of division, Pnpix which is a power of 2) and total number of pixels equal to npix := 12n2side , such that k=1 nk = n, and each with an area of 4π/npix . e j , j = 1, 2, . . . n, on the sphere S2 , then for each pixel/ If we are given a random sample X quadrilateral Πk , k = 1, 2, . . . npix we set an integer nk which counts the number of the sample elements contained in the pixel Πk . We use the nested numbering scheme for ordering pixels, where Πk is the k th pixel according to this scheme. The nested scheme is appropriate for decreasing the resolution, since one can easily accumulate the samples included in 4 ‘neighboring’ pixels. We define the histogram H (e x) such that it is constant over a quadrilateral Πk and the integral over the sphere is 1: H (e x) =
npix nk , 4πn
x e ∈ Πk .
We plot the histogram drawing a column with height npix nk /4πn over each quadrilateral. For ej , j = 1, 2, . . . n = 212 , be a random sample from the uniform distribution and instance, let X nside = 23 , so that npix = 768. We plot the sample and the corresponding histogram in Figure 4.
18
An important feature of the histogram lies in the plot construction. Mathematically, when the columns from each quadrilateral are extruded from the surface of the sphere, the height is measured normal to the center of the pixel, and the volume is given as that height times the area of the quadrilateral, as described above, and as is as expected. However, graphically we also extrude all of the pixel edges normal to their respective location on the sphere. This results in taller columns having larger patches and shorter patches having smaller patches at their respective termini, and stands that maintain pixel surface area at all elevations, which forces adjacent columns to becoming increasingly separated as column height increases, and results in a pin cushion type histogram.
4
Simulation of Random Variates on the Sphere
There will be some common features of all simulations below. These are the following: 1. We consider the case κ ≥ 0, in formulae, but also handle the the case κ ≤ 0, during e with |κ| and as a final step (but before rotation) simulation. We simulate a random variate X e (see Remark 1). e to −X change the variate X 2. All algorithms below concern the case when the frame of reference is xyz, with the modal/mean e. direction as the North pole, i.e. µ e=N 3. The plots are generated by the following parameters: Sample size is n = 212 = 8, 192, resolution of the discretized sphere S2 is nside = 23 , which yields a total pixel count of npix = 768. The resolution for theoretical density plots is 101 × 101 of the set of angles (ϑ, ϕ) ∈ [0, π] × [0, 2π]. h i 4. We characterize a rotation corresponding to M = µ e1 , µ e2 , µ e3 , by a vector µ e and an angle ψ, such that µ e3 represents µ e and µ e1 , µ e2 defines the angle ψ, see Subsection 2.1 for details. See Algorithm 1, in Supplement for the case, when a vector µ e and an angle ψ are given.
19
Note, P (Ψ + ψ ≤ x) = P (Ψ ≤ x − ψ), hence when an angle of a random variate is changed by ψ, then the corresponding density is changing by −ψ.
4.1
Acceptance-rejection method
For the simulation of random variates from the various distributions presented here, we make frequent use of the standard acceptance-rejection method. For a detailed account of this classic simulation technique, see Neumann [1951], Rubinstein [1981], but a general overview of the method for any particular distribution is as follows. We wish to sample random variate X from a calculable target distribution with density fX (x), for which the simulation process is either exceptionally difficult, or perhaps even unknown. Because fX (x) is calculable, we can write the density fX (x) = cg (x) h (x), where the constant c ≥ 1, 0 < g (x) ≤ 1, and h (x) is a probability density function from which we know how to sample. The algorithm of this general method based on testing the inequality U ≤ g (Y ), where U is uniform on the interval (0, 1), and if it is fulfilled, then Y will be accepted as a random variate from fX (x). The corresponding algorithm is given in Supplement, Algorithm 2. In practice, we seek a density h (x) such that
fX (x) ≤ c1 h (x) ,
where c1 ≥ 1, then set g (x) = fX (x) /c1 h (x) and denote to the denominator as the envelope, and use the above algorithm. To maximize algorithmic efficiency, the acceptance ratio 1/c1 should be maximized such that the constant c1 is as close to one as possible, which naturally depends on the choice of density h (x). If feX coincides with fX except some constant cf , fX ∼ h coincides with h = feX , and similarly e except some constant ch , hX ∼ hX , and feX ≤ e h, then =e
cf feX (x) = fX (x) ≤ cf e h (x) =
20
cf e ch h (x) = c1 h (x) , ch
where 1/c1 = ch /cf is the acceptance ratio. Therefore the test can be performed by checking the inequality U ≤ g (Y ) =
feX (Y ) fX (Y ) , = e c1 h (Y ) h (Y )
(21)
where again Y and U , are distributed by h (y) and uniform respectively. This method has been used extensively by Wood (Wood [1988], Wood [1987]), and we employ this technique in many ways. Ulrich (Ulrich [1984]) proposes a general method for simulating a rotationally symmetric variable.
4.2
Simulation of FB families
We shall describe the simulation of the canonical variates. The necessary rotation can be done separately in each case and is included in the appropriate scripts of the MATLAB package ‘3DDirectional Statistics, Simulation and Visualization’ (3D-Directional-SSV). We shall use the well known basic algorithms for simulation of spherical uniform, vMF and DW random variates (Supplement, Alg.3-6). The inequality (21) shows that for the simulation we do not need the normalizing constants, although they are needed for calculating the acceptance ratios. If these constants are not available analytically, we use numerical integration for calculating the acceptance ratios.
4.2.1
Model GFB4
GFB4 generalizes both the vMF and DW models. We use the envelopes proposed by Wood (Wood [1987]) in the application of acceptance-rejection sampling as described above. The density in basic form g4 (x; κ, γ) ∼ = eκx+γx , 2
implies that the longitude Φ = 2πU , where U is uniform distributed independently from the colatitude Θ, and hence, we shall concentrate on simulation of X = cos Θ. Also, we assume that 21
parameters κ and γ are not identically zero otherwise the model is simplified to model either vMF or DW. We consider three cases according to the relation between the parameters κ and γ. 1. If γ < 0, 0 ≤ κ ≤ −2γ, complete the quadratic form in the exponent and rewrite g4 as 2
g4 (x; κ, γ) ∼ = eγ(x+κ/2γ) , x ∈ [−1, 1] ,
and use the Gaussian envelope. The acceptance ratio is large if we assume that the mean −κ/2γ belongs to [−1, 1], which is the case under this assumption. The algorithm of this case is given in the first part of (Supplement, Alg.7). 2. If γ < 0, κ ≥ −2γ, then we use vMF gvM F (x, κ + 2γ) on S2 , as an envelope 3. If γ > 0, an envelope composed of a mixture of gvM F (x, κ + γ) and gvM F (x, κ − γ) vMF distributions is used. The difference between our method (Supplement, Alg.7) and the one described in Wood [1987], is how we partition the case where γ < 0.
1
Some particular cases with interesting features arise in the simulation of models in the GFB5 family. In this vein, we consider GFB4,β , which demonstrates the difficulty of combining two algorithms, as well as the problem of simulation of Φ according to the conditional density gΦ|X . 4.2.2
Model GFB4,β ,
If β 6= 0, γ = 0, κ = 0, the density in basic form is given by 2 gβ (x, ϕ; κ, β) ∼ = eβ (1−x ) cos 2ϕ ,
and has marginal gβ,X (x, β) ∼ = I0 β 1 − x2 1
,
Note, Wood [1987] Procedure FB− 4 , p. 890 has a misprint. The correct expressions are µ1 =
−2γ−κ √ −2γ
22
2γ−κ √ , −2γ
µ2 =
Figure 5: Model GFB4,β and conditional gΦ|X , see (8), densities. The simulation of the marginal X is based on the inequality 1 c I0 β 1 − x2 ≤ (p1 fW (x; −β) + p2 fW (x; β)) . cI 2cI With the mixture of two DW densities, one is bipolar, β > 0, and the other one is girdle, −β < 0. where Z
1
cI =
I0 β 1 − x2
dx.
−1
Now, we use the acceptance-rejection method for simulation of X = cos Θ, with an acceptance ratio of 2cI /c that is decreasing as β is increasing. The corresponding algorithm is Algorithm 8, Supplement, see Figure 5. The simulation of longitude Φ according to the conditional density gΦ|X is given by simulating 2Φ as a vMF distributed random variate on S1 (see Remark 3). It yields a value in [0, π], and hence, Φ itself will be an element in [0, π/2]. The density function gβ has the same value at Φ, −Φ, Φ + π, and −Φ + π, therefore we shall extend the simulated value randomly. The algorithm (Supplement, Alg.9), will be used in more general cases as well, since the conditional densities do not change in different sub-families.
23
4.2.3
Model GFB5,K
Here we consider the Kent model GFB5,K , and note that the equal-area projection simplifies the problem of simulating two independent random variates.2 Equal-area projection, case 2β ≤ κ This part of the simulation of the Kent model GFB5,K 2 2 f5 (e x; κ, β) ∼ = eκex3 +β (xe1 −ex2 ) ,
has been considered by Kent (Kent and Hamelryck [2005]) under the assumption,
0 ≤ 2β ≤ κ.
(22)
This is the case when the exponent of the density is a nonincreasing function of ϑ for each ϕ, and when the model is unimodal (see Figure 6). The Kent model, GFB5,K , under transformation (12) has the form 4 2 4 2 f5 (y1 , y2 ; κ, β) ∼ = e−2(κ−2β)y1 −4βy1 e−2(κ+2β)y2 +4βy2 ,
which is a product of two densities. Introduce
α1 = κ − 2β,
α2 = κ + 2β,
in this parametrization the density has the form 2 4 2 4 f5 (y1 , y2 ; κ, β) ∼ = e−2α1 y1 −4βy1 e−2α2 y2 +4βy2 .
If assumption (22) holds then α1 ≥ 0, 2
α2 ≥ 0,
See subsection 2.2.1 for details.
24
(23)
Figure 6: Model GFB5,K , unimodal: 2β ≤ κ, from left to right: density, sample, histogram and we use Kent’s algorithm Kent and Hamelryck [2005], given in Algorithm 10 (Supplement). We simplify Kent’s algorithm, using a Gaussian envelope instead of the exponential envelope. From Kent’s method, we stop at the first inequality and apply the acceptance-rejection method right there. The basic inequality is given by, 1 1 − δ 2 w2 ≤ τ 2 − δτ |w| , 2 2 Setting δ =
√
δ, τ > 0.
8β, and τ = 1, we have
exp
−2α1 y12
−
4βy14
≤ exp
p 2 1 1 − 4α1 + 8β y1 , 2 2
which gives the Gaussian envelop with variance σ12 = 1/ 4α1 +
exp
−2α2 y22
+
4βy24
√ 8β . Similarly
1 2 ≤ exp − (4α2 − 8β) y2 , 2
yields a Gaussian envelop as well, with variance σ22 = 1/4κ.3 . We combine these two and use acceptance-rejection method in the first part of Algorithm 11 (Supplement). 3
We have corrected a misprint in Kent and Hamelryck [2005] in our algorithm
25
Equal-area projection, case 2β > κ We are also interested in the case when the density increasing and decreasing in ϑ around ϕ = 0.
0 ≤ κ ≤ 2β,
In this case,
α1 = κ − 2β ≤ 0, α2 = κ + 2β ≥ 0.
Let us start with the first component of (23), exp (−2α1 y12 − 4βy14 ). The polynomial p (y1 ) = −α1 y12 − 2βy14 ,
in the exponent is symmetric to zero. We restrict the variable y1 such that |y1 | ≤ 1, hence we p have two maximums at y0 = ± (1 − κ/2β) /2, where β p (y0 ) = 2
2 κ 1− . 2β
Therefore we separate the interval [−1, 1] and use Gaussian envelope
exp
−2α1 y12
−
4βy14
β κ + 2 ≤ exp −2 1− y1 − y0 + p (y0 ) , 2 2β
(24)
on [0, 1]. This envelope will exactly match the target density at the maximum, otherwise it is greater. Similarly
exp −2α2 y22 + 4βy24 ≤ exp − (2α2 − 4β) y22 = exp −2κy22 ,
26
(25)
Figure 7: If 2β > κ, then the model GFB5,K , is bimodal
Figure 8: Model GFB6 , κ = 1.5; β = 0.61; γ = 0.31; µ = [1, −1, 1], ψ = 0; provide a Gaussian envelop as well, with variance σ22 = 1/4κ. The second part of Algorithm 11 (Supplement) is based on these two inequalities (24) and (25). If 2β > κ, then the model is bimodal, but not bipolar, and the cosine of the angle, η, between the modal directions is cos η = κ/2β. We put κ/2β = 1/2, and hence η = π/3 (see Figure 7).
4.2.4
Model GFB6
The Kent model GFB5,K and the Bingham Model GFB5,B are included here since, as we shall see, there is only a small difference whether κ = 0, or γ = 0. If κ = 0, we have paid particular attention to the case γ = β 6= 0, see Remark 5. We repeat the method applied for the F Bβ , β 6= 0, with κ and γ, then we use a mixture of two F B4 densities. The corresponding algorithms can be found in (Supplement, Alg.9) and (Supplement, Alg.12).
27
4.3
Spherical Distributions and Simulation of spherical harmonics
If a density f (e x) is continuous then it has series expansion in terms of spherical harmonics Y`m ,
f (e x) =
∞ X ` X
m am x) . ` Y` (e
(26)
`=0 m=−`
The coefficients {am ` } can be considered as a characteristic function, they are complex valued, am∗ = (−1)m a−m ` ` , and are given by am `
Z =
f (e x) Y`m∗ (e x) Ω (de x) .
(27)
S2
The notation ∗ is defined as the transpose and conjugate of a matrix and just the conjugate for a scalar. Several symmetries of distributions are characterized in terms of coefficients am ` , (27), see [JT17]. √ √ Notice that the spherical harmonic4 Y00 = 1/ 4π, and hence a00 = 1/ 4π is the normalizing x) = sin ϑdϑdϕ is the Lebesgue element of surface area on S2 . For a constant for f (e x) and Ω (de detailed account of Spherical Distributions and Harmonic Analysis see [JT17] Let x e (ϑ, ϕ) be a point on the unit sphere S2 , then the spherical harmonics are defined by s Y`m (ϑ, ϕ) = (−1)m
2` + 1 (` − m)! m P` (cos ϑ) eimϕ , ϕ ∈ [0, 2π] , ϑ ∈ [0, π] , 4π (` + m)!
where P`m denotes associated normalized Legendre function of the first kind. Real-valued spherical harmonics. Spherical harmonics are, in general, complex valued, due to the dependence of longitude ϕ given by eimϕ . Now, eimϕ is a complete orthogonal system on the circle which is equivalent to the sine-cosine system for real-valued functions. Similarly, 4
Some of the first spherical harmonics are listed in [JT17].
28
Figure 9: Square of real spherical harmonics, L = 4, m = 1, 2, 3 real-valued spherical harmonic functions are defined as
Y`,m =
√1 2
Y`m + (−1)m Y`−m
m>0
Y`m 1 √
i 2
m=0
Y`−m − (−1)m Y`m
(28)
m 0 are said to be of cosine type, and those with m < 0 of sine type. 2 , when m = 1, 2, 3 5 . Figure 9 contains three densities among Y4,m
Example 4.1. Exponential family class of distributions Watson [1983],
g (e x) = exp
` M X X
m bm x) , ` Y` (e
`=0 m=−` 0 where bm∗ = (−1)m b−m ` ` . The normalizing constant corresponds to b0 and depends on the rest of
the bm ` parameters, such that the integral is necessarily 1. The likelihood of observations often has this form. In the case of rotational symmetry around axis x e0 fe (e x) = exp
M X
! b` P` (cos ϑ)
`=0
where ϑ is the angle between x e and x e0 , and P` denotes the Standardized Legendre polynomial 5
One may plot densities according to module square of complex and real spherical harmonics for any given L and all m ∈ [−L, L] by the command dx = Density SphHarm All(L, m, Real,resolution); if m ∈ / [−L, L] then 2 all YL,m will be plotted, see our MATLAB package ‘3D-Directional Statistics, Simulation and Visualization’ (3DDirectional-SSV) for details.
29
(P0 (x) = 1). Example 4.2. Another useful class of density functions is given by, 2 ∞ X ` X m m d` Y` (e x) , f (e x) = `=0 m=−`
where
P∞ P` `=0
m=−`
2 |dm ` | = 1. This class of distributions are of interest in, amongst other topics,
the modeling of atoms. In quantum mechanics, Y`,m (e x)2 is considered as a probability density function, and plays an important role in the modeling of the hydrogen atom. The module square |Y`m (e x)|2 is also a density function that serves as an example of a rotational symmetric density function on the sphere, as it only depends on cos ϑ.
4.3.1
Simulation of modulus-square of complex harmonics
Consider the density |Y`m (e x)|2 on S2 with respect to Lebesgue measure sin ϑdϑdϕ. We have |Y`m (e x)|2 =
2` + 1 (` − m)! m P (cos ϑ)2 , 4π (` + m)! `
where P`m is associated normalized Legendre function of the first kind. |Y`m (e x)|2 is rotational symmetric and 2π |Y`m |2 will be a density on [−1, 1]. More precisely, the function 2 m f`m (x) = cm ` P` (x) ,
where cm ` =
2` + 1 (` − m)! , 2 (` + m)!
is a density on [−1, 1]. We have |Y`m (e x)|2 = f`m (cos ϑ)2 /2π. For convenience (MATLAB) we use 2 m m the fully normalized associated Legendre function pm ` , such that f` (x) = p` (x) .
30
2 For general ` and m and pm ` (x) , one can use Forsyth’s method Atkinson and Pearce [1976], 2 with intervals defined by the zeros of pm ` (x) and Beta envelopes, say. In particular, let ` = 3,
m = 2. then p23 (x)2 has a root at 0 and is symmetric around zero. For generating X, we apply the Neumann Theorem for 2f32 (x), (Supplement, Alg.13), since the Beta distribution with shape parameters α = 3.08 and β = 2.5249, proved to be an efficient envelope for the density 2f32 (x). The beta density is given by the function b (x, α, β) = xα−1 (1 − x)β−1 /B (α, β), and the above shape parameters (α = 3.08 and β = 2.5249) were found with the following steps: 1. let α, β > 1, 2. use the relation (α − 1) / (α + β − 2) = xM , between α and β, where xM is the maximum point (modus) of 2f32 (x), 3. find the set of α and β under the (simultaneous) constraints: i) max (2f32 (x) /b (x, α, β)) ≥ 1 x 2 ii) max min (2f3 (x) /cb (x, α, β)) ≤ 1 α
x
2 4. choose a pair α and β, such that min max (2f3 (x) /b (x, α, β)) is achieved α
x
We then have,
2f32 (x) =
2f32 (x) b (x, α, β) b (x, α, β)
= cg32 (x) h23 (x) , with c = max (2f32 (x) /b (x, α, β)), h23 (x) = b (x, α, β), and 0 ≤ g32 (x) = 2f32 (x) / (cb (x, α, β)) ≤ 1. We have found that c = 1.074, showing a high acceptance ratio.
31
x)|2 Figure 10: Simulation of density |Y`m (e 4.3.2
2 Simulation of real harmonics Y3,2
2 Consider the real spherical harmonics Y3,2 (28). The density function Y3,2 is given by
2 1 7 1 2 2 1 Y32 + Y3−2 = P3 (cos ϑ)2 ei2ϕ + e−i2ϕ 2r 2 4π 5! 7 1 2 P3 (cos ϑ)2 cos2 2ϕ. =2 4π 5!
2 Y3,2 =
2 This is a multimodal, non-rotationally symmetric distribution. The density function Y3,2 is the
multiplication of the density of Θ and the density of Φ respectively, which implies that the angles Θ and Φ are changing independently. The simulation of Θ according to the density 2 ∼ = P32 (cos ϑ) sin ϑ, has been solved during the simulation of module square of complex harmonics
above. The simulation of Φ by the density ∼ = cos2 ϕ is based on the following: √ Let B be Beta distributed with α = 3/2 and β = 1/2, and define X = arccos B . Then, from the equality √ FX (x) = P arccos B ≤ x = P B > cos2 x , it follows
fX (x) = 2fB cos2 x cos x sin x =
1/2 −1/2 2 4 cos2 x cos2 x sin2 x cos x sin x = b (α, β) π 32
(29)
2 Figure 11: Simulation of density Y3,2
Similarly, if B is a Beta distributed variate with α = 1/2 and β = 3/2,
fX (x) = 2fB cos2 x cos x sin x =
−1/2 3/2 2 4 sin2 x . cos2 x sin2 x cos x sin x = b (α, β) π
2 The latter of the two formulations for fX (x) is used for the simulation of Y3,−2 . √ We conclude that the density of Φ = arccos B is ∼ = cos2 ϕ, on [−π/2, π/2]. Once we have a
random variate on [−π/2, π/2] with density function depending on cos ϕ we can easily transform its values periodically to the interval [0, 2mπ], say. Algorithm 14 (Supplement), works for the density 2 f (e x) ∼ = P32 (cos ϑ) cos2 2ϕ,
in this case we choose m = 2, since the longitude ϕ should have values on [0, 2π], and we have the random variate 2Φ on [−π/2, π/2]. One can generalize this method for density ∼ = cos2 kϕ, where k is an integer.
4.4
Simulation of U −distribution
Finally, we examine the U −distribution (not to be confused with the uniform distribution), which is a simple distribution on the sphere that is not rotational symmetric. Consider U1 , U2 , U3 uniform on [0, 1], independent variates. Then, we can define,
33
p e ∈ S2 , Z e = [Z1 , Z2 , Z3 ] = (U1 , U2 , U3 )> / U12 + U22 + U32 , Z e = (sin Θ cos Φ, sin Θ sin Φ, cos Θ) Z We have U2 Z2 = Z1 U1 U2 < tan (ϕ) P (Φ < ϕ) = P U1 tan (ϕ) if 0 ≤ ϕ < π/4 2 , = 1 1− if π/4 ≤ ϕ < π/2 2 tan (ϕ) tan (Φ) =
and see mathematically that it is not the uniform density function
1 if 0 ≤ ϕ < π/4 2 cos2 (ϕ) fΦ (ϕ) = 1 if π/4 ≤ ϕ < π/2, 2 sin2 (ϕ) Now, consider the conditional density fΘ|Φ (ϑ|ϕ) for a fixed Φ = ϕ, Z1 U1 = ; Z3 U3 U1 < cos (ϕ) tan (ϑ) P (Θ < ϑ|Φ = ϕ) = P U3 cos (ϕ) tan (ϑ) if ϕ ∈ [0, π/4] , ϑ ∈ [0, π/2] , cos (ϕ) tan (ϑ) ≤ 1 2 = , 1 1− if ϕ ∈ [0, π/4] , ϑ ∈ [0, π/2] , cos (ϕ) tan (ϑ) > 1 2 cos (ϕ) tan (ϑ) tan (Θ) cos (Φ) =
cos (ϕ) if ϕ ∈ [0, π/4] , ϑ ∈ [0, π/2] , cos (ϕ) tan (ϑ) ≤ 1 (ϑ) cos2 (ϕ) fΘ|Φ (ϑ|ϕ) fΦ (ϕ) = 1 if ϕ ∈ [0, π/4] , ϑ ∈ [0, π/2] , cos (ϕ) tan (ϑ) > 1 2 16 sin (ϑ) cos3 (ϕ) 16 cos2
The U −distribution is a unique and interesting example of a spherical distribution that is antipodal, but not isotropic or rotationally symmetric.
34
Figure 12: U −distribution.
Appendix: Spherical harmonics Orthonormal spherical harmonics with complex values Y`m (ϑ, ϕ), ` = 0, 1, 2, . . ., m = −`, −` + 1, . . . − 1, 0, 1, . . . , ` − 1, ` of degree ` and order m (rank ` and projection m) s
2` + 1 (` − m)! m P (cos ϑ) eimϕ , ϕ ∈ [0, 2π] , ϑ ∈ [0, π] , 4π (` + m)! `
Y`m (ϑ, ϕ) = (−1)m
(30)
where P`m denotes associated normalized Legendre function of the first kind. The spherical harmonics are eigenfunctions of the square of the orbital angular momentum operator.
r
2` + 1 P` (cos ϑ) , r 4π 1 Y00 (ϑ, ϕ) = , 4π
Y`0 (ϑ, ϕ) =
(31)
more over r e = δm,0 2` + 1 . Y`m N 4π
(32)
Y`m is fully normalized Z 0
2π
Z
π
|Y`m (ϑ, ϕ)|2 sin ϑdϑdϕ = 1.
0
Some detailed account of spherical harmonics Y`m can be found in Varshalovich et al. [1988] and Stein and Weiss [1971]. 35
√ some authors do not apply 1/ 4π in the definition of Y`m , also for a sphere with radius R spherical harmonics are normalized additionally Y`m (ϑ, ϕ) /R. It also follows Y`m∗ (ϑ, ϕ) = Y`m (ϑ, −ϕ) = (−1)m Y`−m (ϑ, ϕ) , Y`−m (ϑ, ϕ) = (−1)m e−i2mϕ Y`m (ϑ, ϕ) . Inversion x e → −e x, (ϑ, ϕ) → (π − ϑ, π + ϕ) Y`m (−e x) = (−1)` Y`m (e x) .
(33)
Addition formula (see Gradshteyn and Ryzhik [2000], 8.814,Erd´elyi et al. [1981], 11.4(8)), ` X
Y`m∗ (e x1 ) Y`m (e x2 ) =
m=−`
where cos ϑ = x e1 · x e2 .
` X
2` + 1 P` (cos ϑ) , 4π
Y`m∗ (e x) Y`m (e x) =
m=−`
36
2` + 1 , 4π
(34)
(35)
SUPPLEMENTARY MATERIAL I. MATLAB scripts for Figures and Algorithms: (pdf) 1. Figures: Listing of all the MATLAB scripts for Figures contained in the paper using the package “3D-Directional-SSV” 2. Algorithms: Listing of all the Algorithms in this paper using the package “3D-DirectionalSSV”). II. 3D-Directional Statistics, Simulation and Visualization MATLAB Package to simulate and visualize spherical distributions in 3-dimensions including the family of GeneralizedFisher-Bingham distributions. “3D-Directional-SSV” MATLAB scripts, see also: https://www.mathworks.com/matlabcentral/fileexchange/66646-3d-directional-statistics, (zipped file).
References A. C. Atkinson and M. C. Pearce. The computer generation of beta, gamma and normal random variables. Journal of the Royal Statistical Society. Series A (General), pages 431–461, 1976. C. Bingham. An antipodally symmetric distribution on the sphere. The Annals of Statistics, pages 1201–1225, 1974. E. Dimroth. Untersiichungen aim wechanismiis von blastais und syntexis. Phylliterr and Hodelsen des siidm3lichen Fichtelgebirges I. Die statistische Airswertung einfacher Giirteldi.agranime. Txheim. Man. Pctr. Mitt., 8:248–274, 1962. A. Erd´elyi, W. Magnus, F. Oberhettinger, and F. G. Tricomi. Higher transcendental functions. Vol. I. Robert E. Krieger Publishing Co. Inc., Melbourne, Fla., 1981. ISBN 0-89874-069-X.
37
Based on notes left by Harry Bateman, With a preface by Mina Rees, With a foreword by E. C. Watson, Reprint of the 1953 original. R. A. Fisher. Dispersion on a sphere. Proceedings of the Royal Society of London A: Mathematical, Physical and Engineering Sciences, 217(1130):295–305, 1953. K. M. Gorski, E. Hivon, A. J. Banday, B. D. Wandelt, M. Hansen, F. K .and Reinecke, and M. Bartelmann. HEALPix a framework for high-resolution discretization and fast analysis of data distributed on the sphere. The Astrophysical Journal, 622(2):759, 2005. I. S. Gradshteyn and I. M. Ryzhik. Table of integrals, series, and products. Academic Press Inc., San Diego, CA, sixth edition, 2000. ISBN 0-12-294757-6. Translated from the Russian, Translation edited and with a preface by Alan Jeffrey and Daniel Zwillinger. J. T. Kent. The Fisher-Bingham distribution on the sphere. Journal of the Royal Statistical Society. Series B (Methodological), pages 71–80, 1982. J. T Kent and T. Hamelryck. Using the Fisher-Bingham distribution in stochastic models for protein structure. Quantitative Biology, Shape Analysis, and Wavelets, 24:57–60, 2005. J. T Kent, A. M Ganeiber, and K. V Mardia. A new unified approach for the simulation of a wide class of directional distributions. Journal of Computational and Graphical Statistics, (justaccepted), 2017. doi: 10.1080/10618600.2017.1390468. URL http://dx.doi.org/10.1080/ 10618600.2017.1390468. K. V. Mardia and P. E. Jupp. Directional Statistics, volume 494. John Wiley & Sons, 2009. J. von Neumann. Various techniques used in connection with random digits. U.S. Nat. Bur. Stand. Appl. Math. Ser.,, 12:36–38, 1951. S. Rao Jammalamadaka and H. Gy. Terdik. Harmonic analysis and distribution-free inference for spherical distributions. arxiv:1710.00253 [stat.me], UCSB and UD, 2017.
38
R Y. Rubinstein. Simulation and the Monte Carlo Method. John Wiley & Sons, Inc., 1981. E. M. Stein and G. Weiss. Introduction to Fourier analysis on Euclidean spaces. Princeton University Press, Princeton, N.J., 1971. Princeton Mathematical Series, No. 32. G. Ulrich. Computer generation of distributions on the m-sphere. Applied Statistics, pages 158– 163, 1984. D. A. Varshalovich, A. N. Moskalev, and V. K. Khersonskii. Quantum Theory of Angular Momentum. World Scientific Press, 1988. G. S. Watson. Equatorial distributions on a sphere. Biometrika, 52(1/2):193–201, 1965. G. S. Watson. Statistics on spheres. Number 6 in University of Arkansas Lecture Notes in the Mathematical Sciences. John Wiley & Sons, Inc., New York, 1983. A. T. A. Wood. The simulation of spherical distributions in the Fisher-Bingham family. Communications in Statistics-Simulation and Computation, 16(3):885–898, 1987. A. T. A. Wood. Some notes on the Fisher–Bingham family on the sphere. Communications in Statistics-Theory and Methods, 17(11):3881–3897, 1988.
39