Forums Neueste Beiträge
 

sample randomly from rotationally symmetric probability distribution

17/03/2010 - 09:54 von HannesF | Report spam
I'm facing a (for me) tough problem. Given is a d-dimensional
multivariate, rotational symmetric probability distribution. In my
application, I use the so-called multidimensional 'Epanechnikov
distribution' (it is commonly used as a 'kernel' in the nonparametric
clustering algorithm 'Mean Shift').

The Epanechnikov probability distribution ('Epenachnikov kernel') is
given by the function K(x) = C * (1 - ||x||^2), for ||x|| <= 1, and 0
otherwise. Here 'x' is a d-dimensional vector, ||x|| is the usual
euclidian norm (2-norm), and C is a normalization constant so that
K(x) integrates to 1 over the whole d-dimensional space. (In fact, C 1/2 * (1/s) * (d + 2), where s is the volume of the d-dimensional unit
sphere).

My task is now to take random d-dimensional 'samples' from the
probability distribution K(x). How can this be done ?
I think the best way is to describe the random sample vector v in
'generalized spherical coordinates' (e.g. see
http://planetmath.org/encyclopedia/...nates.html). So v (r, phi_1, ..., phi_(d-2), theta), where r = ||x|| is the length of
the vector.

The d - 2 polar angles phi_1, ..., phi_(d-2) are randomly sampled from
the (continous) uniform distribution U(0, pi) and the azimuthal angle
theta is randomly sampled from the uniform distribution U(0, 2*pi).
But from which distribution has 'r' to be sampled ? It won't be the
uniform distribution U(0,1), as 'smaller' values of 'r' will be more
probable than higher values.

Another related (but not so important) question is how to do this
random sampling in the 'general' rotational symmetric case, when the
probability distribution is of the form 'f(||x||) where f is some
function of the 'radius' of the vector.
 

Lesen sie die antworten

#1 Roland Franzius
17/03/2010 - 10:42 | Warnen spam
HannesF schrieb:
I'm facing a (for me) tough problem. Given is a d-dimensional
multivariate, rotational symmetric probability distribution. In my
application, I use the so-called multidimensional 'Epanechnikov
distribution' (it is commonly used as a 'kernel' in the nonparametric
clustering algorithm 'Mean Shift').

The Epanechnikov probability distribution ('Epenachnikov kernel') is
given by the function K(x) = C * (1 - ||x||^2), for ||x|| <= 1, and 0
otherwise. Here 'x' is a d-dimensional vector, ||x|| is the usual
euclidian norm (2-norm), and C is a normalization constant so that
K(x) integrates to 1 over the whole d-dimensional space. (In fact, C > 1/2 * (1/s) * (d + 2), where s is the volume of the d-dimensional unit
sphere).

My task is now to take random d-dimensional 'samples' from the
probability distribution K(x). How can this be done ?
I think the best way is to describe the random sample vector v in
'generalized spherical coordinates' (e.g. see
http://planetmath.org/encyclopedia/...nates.html). So v > (r, phi_1, ..., phi_(d-2), theta), where r = ||x|| is the length of
the vector.

The d - 2 polar angles phi_1, ..., phi_(d-2) are randomly sampled from
the (continous) uniform distribution U(0, pi) and the azimuthal angle
theta is randomly sampled from the uniform distribution U(0, 2*pi).
But from which distribution has 'r' to be sampled ? It won't be the
uniform distribution U(0,1), as 'smaller' values of 'r' will be more
probable than higher values.



The azimuthal angles are not uniform. The densities are prop
(sin theta_k)^(n-k) dtheta_k.

If you uniformly distribute points on a sphere,
z = Cos theta has a uniform distribution, theta is distributed like
ArcCos[RandomReal[{-1,1}]].


The n-dimensional volume element in sperical coordinates

M ={ {r,0,oo} x {th2,0,pi} x..x {thn-1,0,pi} x {thn,0,2pi}

is

dV = dr*(r*dth1*(sin th2)^n-2)*(r*dth3*(sin th2)^n-3)
.. r*(sin thn)^(n-n)

So you need the normalized CDF of all single angular densities

Integrate(sin x)^(n-k),{x,0,thk}]/Integrate(sin x)^(n-k),{x,0,pi}]

resp 2pi for thn

and of

Integrate[(1-x^2)x^(n-1),{x,0,r}]/Integrate[(1-x^2)x^(n-1),{x,0,1}]


The results are Hypergeometric and Gamma functions.

For inversion compute a numeric Table using NIntegrate for all these
CDF's in the form of

Table[{CDF[x],x},{x,}]

where the x_k-List should be spaced in such a way, that the
CDF[x_k]-List is somehow equidistributed.

Then form the InverseCDF[k], k=1..n as a spline function approximation
using Interpolation.

Finally use the formula for the polar vector

with radius and sinuses^k(angles) as Random variables

X[n_]:={ InverseCFF[n][RandomReal[{0,1}]]



Another related (but not so important) question is how to do this
random sampling in the 'general' rotational symmetric case, when the
probability distribution is of the form 'f(||x||) where f is some
function of the 'radius' of the vector.



For a general r-distribution f replace (1-x^2) by f and integrate to oo.

Probably a beta, gamma or chi distribution for r is a common case and
implemented in Mathematica's statistical function package.



Roland Franzius

Ähnliche fragen