1
$\begingroup$

In a Euclidean space defined by the multivariate normal distribution, what fraction of all points falls within or are tangent to (as opposed to falling outside of) the n-sphere whose center is at the origin and which is tangent to the point p represented by Cartesian coordinates:

vector(θ) =(θ1, θ2, θ3, θ4 θ5, ... θn)

representing sigmas in the multivariate normal distribution in n dimensions?

This is a post-doctoral question and I could not find it in the literature. I tried searches for the terms you see in the subject line.

p.s. in terms of the picture in the link, the question is: "what fraction of all the dots are in the green circle?" (where in this case the green circle is defined by an arbitrary point on its circumference.)

In terms of R-programming-language code I would like to give a vector and get back a number between 0 and 1.

$\endgroup$
4
  • 1
    $\begingroup$ But the green thing in your picture is not a circle, it is an ellipse. Which one are you asking about, circle or ellipse? For the ellipse the question should be easier. $\endgroup$ Commented Feb 15, 2021 at 11:53
  • $\begingroup$ As stated I would be interested in an n-ball (aka n-sphere). Could you give en.wikipedia.org/wiki/R_(programming_language) based on a vector describing the cartesian coordinates describing a point on the n-ball's surface? $\endgroup$ Commented Feb 15, 2021 at 14:38
  • $\begingroup$ @Will Sawin: Do you noticed an error in my answer? Then please give a pointer to this error. $\endgroup$ Commented Feb 19, 2021 at 11:17
  • $\begingroup$ @DieterKadelka I am sorry! I saw this question in the close queue or maybe one of the other queues, which doesn't display answers, so it's possible to accidentally comment as if a question hasn't been asnwered. In this case, that appeared rather rude... $\endgroup$
    – Will Sawin
    Commented Feb 19, 2021 at 14:04

1 Answer 1

2
$\begingroup$

Unfortunately the question is in no sense precise. Here is one solution which may be what you want. Assume that a random vector $X = (X_1,\ldots,X_n)$ has the multivariate normal distribution $\mathcal{N}(\mu,\Sigma)$ with mean $\mu = 0$ (the $n$-sphere is centered) and covariance matrix $\Sigma$. The problem seems to be the calculation of $$\mathbb{P}(X_1^2 + \ldots + X_n^2 \leq \theta_1^2 + \ldots + \theta_n^2)?$$ To simplify things we assume that $\Sigma$ is positive definite (not only semidefinite). Then $\Sigma = A \cdot \Delta \cdot A^T$ with some orthonormal matrix $A$ (i.e. $A \cdot A^T = A^T \cdot A = E_n$, $E_n$ the $n$-dimensional unitmatrix) and a diagonal matrix $\Delta$ with positive diagonal elements $\lambda_1,\ldots,\lambda_n$. For the following you only need $\lambda_i$, $i = 1,\ldots,n$. In R you get $\lambda_i$ with

lambda = eigen(Sigma)$values

By assumption $\Sigma = \mathbb{E}XX^T$, hence $\mathbb{E}A^TX(A^TX)^T = A^T\mathbb{E}(XX^T)A = A^T \Sigma A = \Delta$. It follows that $Y = A^TX$ has the covariance matrix $\Delta$. Since the $n$-sphere is not changed by the transformation $A^T$ (here it is important that it is a ball and not an ellipsoid) we can replace the original vector $X$ by the vector $Y = (Y_1,\ldots,Y_n)$ with independent $\mathcal{N}0,\lambda_i)$-distributed $Y_i$ and the problem now is: What is the probability $$\mathbb{P}(X_1^2 + \ldots + X_n^2 \leq \theta_1^2 + \ldots + \theta_n^2) =\mathbb{P}(Y_1^2 + \ldots + Y_n^2 \leq \theta_1^2 + \ldots + \theta_n^2)?$$ Now $Y_i^2/\lambda_i$ has the distribution $\chi_1^2 = \Gamma_{1/2,1/2}$, (the first parameter is the shape p., the second the rate parameter), hence $Y_i^2$ the distribution $\Gamma_{1/2,\lambda_i/2}$. The distribution function of $Y_1^2 + \ldots + Y_n^2$ can be calculated with the R-library coga as $$\mathbb{P}(Y_1^2 + \ldots + Y_n^2 \leq t) = \text{pcoga}(t,c(1/2,\ldots,1/2),c(\lambda_1/2,\ldots,\lambda_n/2))$$ Inserting $t = \theta_1^2 + \ldots + \theta_n^2$ you get the value you want. There is also an approximate version of this routine: pcoga_approx.

To apply coga, you have to open R and then run

install.packages('coga') # only do this once

library(coga)

Sigma = matrix(c(1,0.5,0.3,0.5,1,1.4,0.3,1.4,5),nr=3) # only an example

lambda = eigen(Sigma)$values

n = 3 # dimension of Sigma

t = 1.4 # the value you are interested in

P = pcoga(t,rep(1/2,n),lambda/2)

Then R returns $P = 0.3028432$.

Edit: Changed install.library to install.packages and in the formula for P divided lambda by 2. The value of P is changed.

$\endgroup$
6
  • $\begingroup$ Thank you this seems to be what I want. For putting it into practice, at the end you mention the coga library and the dcoga_approx routine. Could you show me how I could use these to do the calculation you suggest, such as with an example? I am not skillful enough to put it into R (programming language) due to not being familiar enough with the techniques you mention and with the programming language. From what you've written it looks like the result will be what I want. $\endgroup$ Commented Feb 17, 2021 at 12:01
  • $\begingroup$ The original answer with dcoga gave the density, not the distribution function pcoga. $\endgroup$ Commented Feb 17, 2021 at 13:11
  • $\begingroup$ @aputnamist2: If you want to implement the algorithm do not use the unedited version. $\endgroup$ Commented Feb 18, 2021 at 7:46
  • $\begingroup$ thank you so much! I was able to run the code you shared. But I don't exactly understand what n = 3 #dimension of Sigma means. In the third line of your code you wrote Sigma = matrix(c(1,0.5,0.3,0.5,1,1.4,0.3,1.4,5),nr=3) which I would expect is a vector representing 9-dimensional space (with sigmas of 1,0.5,0.3,0.5,1,1.4,0.3,1.4,5). So what does nr = 3 mean there? Where does a dimensionality of 3 come in? I would expect the dimensionality to be 9 for this example! I hope you can explain in a way that I can understand. $\endgroup$ Commented Feb 27, 2021 at 22:10
  • $\begingroup$ I also notice that for the list (1,0.5,0.3,0.5,1,1.4,0.3,1.4,5) the last value is a 5. That represents 5 sigma so I would expect an answer like 0.9999997133 (fraction of points inside the n-ball tangent to that coordinate) or 0.0000002867 (fraction of points outside of the n-ball). The provided answer of P = 0.30 seems plainly wrong for what I'm asking. $\endgroup$ Commented Feb 28, 2021 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .