Isotropic random vectors

August 10, 2011 — May 24, 2021

algebra
functional analysis
geometry
high d
linear algebra
measure
probability
signal processing
sparser than thou
spheres

wow! This notebook entry is now 10 years old. I have cared about this for ages.

Random variables with radial symmetry; It would be appropriate to define these circularly, so I will, which is to say, (centred) isotropic random vectors are those whose distribution is unchanged under fixed rotations, or random rotations. Generating such variables. Distributions thereof.

In particular, I consider fun tricks with isotropic Gaussians, RVs uniform on the d-sphere or on the d-ball, i.e. things where their distribution is isotropic with respect to the Cartesian inner product and thus the 2 norm ends up being important. Much of this generalises to general spherically-contoured distributions (as opposed to just distributions on the sphere, which is a terminological wrinkle I should expand upon).

Figure 1

To begin, consider Rd with the L2 norm, i.e. d-dimensional Euclidean space.

1 Simulating isotropic vectors

Let’s say you wish to simulate a random variable, X whose realisations are isotropically distributed unit-vectors (say, to represent isotropic rotations, or for a null-distribution against which to check for isotropy.)

The simplest way I know of generating such vectors is to take XN(0d,Id)

That is, X distributed by a multivariate Gaussian distribution with each component independent and of standard deviation 1, so if Xi are i.i.d. with XiN(0,1), then X=[X1X2Xd]

By the rotational invariance of multivariate Gaussian distributions, we know that this must be isotropic.

Update: Martin Roberts collects a bumper list, How to generate uniformly random points on n-spheres and in n-balls. There are some surprising ones.

1.1 On the d-sphere

Now, to get unit vectors we can simply normalize

UXX

(And if you use the “hit-and-run” Monte Carlo sampler, this is your daily bread.)

1.2 On the d-ball

David K observes the obvious way to generate Lebesgue-uniform vectors on the d ball is to generate spherical vectors then choose a random length L such that they are uniform on the ball. This implied length CDF should be FL(x)=P(Lx)={0x<0xn0x11x>1 implying a pdf fL(x)={nxn10x1,0 otherwise.  But in fact if UUnif([0,1]) then LU1/d.

Bonus time: In fact, we can do more than just 2 spheres - we can also get p balls. See Barthe et al. () (HT Mark Meckes). We simulate [X1,,Xd independently with density fX(x)exp(|x|p), and YExp(1) independent. Then the random vector [X1,,Xd]Y+[X1,,Xd]p is uniformly distributed in the unit ball of pd. When p=2, this resembles the Gaussian RV trick, although they are not trivially the same. For p2 these are not isotropic in the rotationally-invariant sense, though.

2 Marginal distributions

Question: what is the marginal distribution of the axial component Ui, of U, along axis i, in the non-trivial case with d>1?

Let us consider, w.l.o.g., U1. We know that the p.d.f of U1 is even (i.e. has reflective symmetry) by construction. So it will suffice to find the positive half of the distribution function. Thus it will also be enough to find the p.d.f. of U12.

Define X[X2X3Xd] i.e. X is X with the first component of the vector excised. We have U=XXU2=X2X2U12=X12X2U12=X12X2+X121U121=X2X121U121d1=X2/(d1)X12

Now, the R.H.S. has an F(d1,1) distribution, as the ratio of i.i.d χ2 variables, and the work there has already been done for us by Snedecor. We call that R.H.S. G, where GF(d1,1). We write g for the pdf. Then U12=1g(d1)+1

Now we can construct the pdf of U1. In fact, for my purposes I need the quantile/inverse-cdf function, so let’s do that. Call the quantile function of the F(d1,1) distribution, H(x) and the cdf of U1, F(x) (for ‘half’ and ‘full’).

Then we splice two symmetric copies of the function about the axis — F(x)=sgn(2x1)H(1|2x1|) - and we’re done.

Here’s a plot of the behaviour of our distribution:

Figure 2: axial distributions in various dimensions

Notice that axial components tend to be long in R2, and short in more than 3 dimensions. And uniformly distributed in 3 dimensions. Intuitively, as the number of dimensions increases, the contribution of any one axis to the total length is likely to be smaller on average, because there are simply more of them.

And here’s the R code to generate the graph, most of which is plotting logic.

half.quantile <- function(x,d=3) {
    g <- qf(x,d-1,1)
    return(1/sqrt(g*(d-1)+1))
}
full_quantile <- function (x, d=3) {
    x.scaled <- 2*x -1
    res <- sign(x.scaled)*half.quantile(1-abs(x.scaled), d)
    return(res)
}

pts <- seq(0,1,1/512)
dims <- seq(2,10)
ndims <- length(dims)
vals <- data.frame(outer(pts, dims, full.quantile))
dimnames <- paste(dims)
xrange <- c(0,1)
yrange <- c(-1,1)
library(RColorBrewer)
colors <- brewer.pal(ndims,"Spectral")

# set up the plot
plot(xrange, yrange, type="l", xlab="x",
        ylab="quantile")

# add lines
for (i in seq(ndims)) {
    dim <- vals[,i]
    lines(pts, dim, type="l", lwd=2,
    col=colors[i],
    lty=1
    )
}

# add a legend
legend(xrange[1], yrange[2], dims, cex=0.8, col=colors,
        lty=1, title="Dimension")

There are many interesting approximate distributions for these quantities, which are explored in the low-d projections notebook.

3 Inner products

There is an exact distribution for inner products of normalized vectors. Suppose that L=12+\vvXp\vvXq/2. Then LBeta((D1)/2,(D1)/2).

4 Moments

Kimchi lover derives the variance of xi chosen uniformly from the hypersphere:

xUnifBd1Var(X1)=1d+2.

See also Covariance matrix of uniform spherical distribution wherein a very simple symmetry argument gives xUnifSd1Var(X1)=1d. and indeed xUnifSd1Var(x)=1dI.

5 Archimedes Principles

First mention: The first (n2) coordinates on a sphere are uniform in a ball

Djalil Chafaï mentions the Archimedes principle which

… states that the projection of the uniform law of the unit sphere of R3 on a diameter is the uniform law on the diameter. It is the case n=3 of the Funk-Hecke formula…. More generally, if (X1,,Xn) is a random vector of Rn uniformly distributed on the unit sphere Sn1 then (X1,,Xn2) is uniformly distributed on the unit ball of Rn2. It does not work if we replace n2 by n1.

6 Funk-Hecke

Djalil Chafaï introduces the The Funk-Hecke formula:

In its basic form, the Funk-Hecke formula states that for all bounded measurable f:[1,1]R and all ySn1, f(xy)σSn1( dx)=Γ(n2)πΓ(n12)11f(t)(1t2)n32dt The formula does not depend on x, an invariance due to spherical symmetry.…

If this is an inner product with a sphere RV then we get the density for a univariate random projection.

7 References

Barthe, Guedon, Mendelson, et al. 2005. A Probabilistic Approach to the Geometry of the pn-Ball.” The Annals of Probability.
Christensen. 1970. On Some Measures Analogous to Haar Measure. MATHEMATICA SCANDINAVICA.
Grafakos, and Teschl. 2013. On Fourier Transforms of Radial Functions and Distributions.” Journal of Fourier Analysis and Applications.
Meckes. 2012. Projections of Probability Distributions: A Measure-Theoretic Dvoretzky Theorem.” In Geometric Aspects of Functional Analysis: Israel Seminar 2006–2010. Lecture Notes in Mathematics.
Stam. 1982. Limit Theorems for Uniform Distributions on Spheres in High-Dimensional Euclidean Spaces.” Journal of Applied Probability.
Vembu. 1961. Fourier Transformation of the n -Dimensional Radial Delta Function.” The Quarterly Journal of Mathematics.