I have a question i ve been thinking about for a few days:
I want to better understand the statistics of random 3 dimensional unit vectors. For example, i pick two angles $\theta$ and $\phi$ from $U(0,\pi)$ and $U(0,2\pi)$ respectively, i create the random vector $\mathbf {X} = \{\sin \theta \cos \phi, \sin \theta \sin \phi, \cos \theta\}$, repeat this $N$-times, and then i try to obtain the standard deviation over all $N$s of the components of $\mathbf{X}$. The mean is zero (the distribution is symmetric), so the standard deviation is:
$\sigma_i =\sqrt{\frac{1}{N-1} \sum^N X_i^2} \quad (1)$
for the component $i$. This is also how Matlab computes it. Now because of the spherical symmetry, the standard deviations ($N$ large) for all three components should be equal, i.e. $\sigma_1 = \sigma_2 = \sigma_3 = \sqrt{\frac{1}{3}}$, which i can prove with
$\sigma_i^2 = \frac{1}{4 \pi} \int_0^{\pi} \int_0^{2 \pi} X_i^2 \sin \theta d\theta d\phi \quad (2)$.
So equation (1) is wrong, because it misses the $\sin \theta$ weight. If this is implemented, then i obtain the correct result.
My question is now: If i don't know from which distribution i randomly pick the components, but still assume that it is symmetric around $0$ and that $\mathbf{X}$ is a unit vector, will $\sigma_i$ always be $\sqrt{\frac{1}{3}}$? And is there a way to obtain the weight just from equation (1) and the $X_i$'s?
Any help is appreciated !
EDIT: I will try to clarify: maybe i am mixing up the standard deviation (as used in the R program) with the second moment of the underlying distribution of the $X_i$'s. I want to find the latter. Here is my mathematica code:
n = 10000;
th = Table[Pi*RandomReal[], {n}]; ph = Table[2*Pi*RandomReal[], {n}];
x = Sin[th]*Cos[ph]; y = Sin[th]*Sin[ph]; z = Cos[th];
wx = WeightedData[x, Sin[ArcCos[z]]];
wy = WeightedData[y, Sin[ArcCos[z]]];
wz = WeightedData[z, Sin[ArcCos[z]]];
{StandardDeviation[x], StandardDeviation[wx]}
{StandardDeviation[y], StandardDeviation[wy]}
{StandardDeviation[z], StandardDeviation[wz]}
{0.499561, 0.578086} -> unweighted gives 1/2, weighted gives Sqrt[1/3]
{0.500725, 0.579126} -> unweighted gives 1/2, weighted gives Sqrt[1/3]
{0.706939, 0.574878} -> unweighted gives Sqrt[1/2], weighted gives Sqrt[1/3]
sqrt(1/3) is what i expect. My question now regards the case of arbitrary underlying distributions of the $X_i$'s