1
$\begingroup$

I have a sample from a distribution invariant w.r.t rotations around 0. What's the best way to incorporate this information into a smooth 3D histogram?

n = 400;
sample := RandomVariate[NormalDistribution[], {n, n}];
products = NestList[sample . # &, sample, 2];
SmoothHistogram3D[ReIm /@ Eigenvalues[#], Axes -> False] & /@ products

enter image description here

$\endgroup$

2 Answers 2

0
$\begingroup$

To account for the "known" radial symmetry about (0,0) first construct the (univariate) density of the distance from (0,0) and then transform to a 2-dimensional density.

(* Take a random sample from a radially symmetric distribution *)
n = 400;
SeedRandom[12345];
sample = RandomVariate[NormalDistribution[0, 1], {n, 2}];

(* The usual nonparametric density estimate *)
skd2 = SmoothKernelDistribution[sample, "LeastSquaresCrossValidation"];

(* Accounting for the knowledge that the bivariate density is symmetric about {0,0} *)
d = Norm[#] & /@ sample; (* Distances from {0,0} *)
skd1 = SmoothKernelDistribution[d, 
   "LeastSquaresCrossValidation", {"Bounded", {0, ∞}, 
    "Gaussian"}];
(* To get the bivariate density estimate from the univariate density
   estimate divide by the circumference *)
pdf[x_, y_] := PDF[skd1, Norm[{x, y}]]/(2 π Norm[{x, y}])

(* Plot both bivariate density estimates *)
Plot3D[{PDF[skd2, {x, y}], pdf[x, y]}, {x, Min[sample], 
  Max[sample]}, {y, Min[sample], Max[sample]}, PlotTheme -> "ZMesh", 
 PlotRange -> {All, All, {0, 0.16}}, PlotPoints -> 100]

Bivariate density estimates for basic nonparametric density and also accounting for radial symmetry about (0,0)

Notice the funny business at (0,0). Unless there are additional assumptions one can make, I think that will just be what one obtains. (That happens from dividing by the distance from (0,0) which is close to zero near (0,0).) For a justification for this approach (or maybe for a "Don't do it that way"), try asking this question at CrossValidated.

$\endgroup$
3
  • $\begingroup$ it looks like an alternative trick is just to add rotations of the data into the dataset $\endgroup$ Commented Jul 25, 2023 at 21:17
  • $\begingroup$ Rather than "trick", I would use tterms like "one more tool in the statistical toolbox" but I get your point. Essentially the same thing can be done with samples from densities known to be symmetric about zero. $\endgroup$
    – JimB
    Commented Jul 25, 2023 at 23:12
  • $\begingroup$ The following link has the same question at CrossValidated with links to solutions: stats.stackexchange.com/questions/613725/…. $\endgroup$
    – JimB
    Commented Jul 25, 2023 at 23:24
0
$\begingroup$

If your question is about getting the same bandwidth for each of the two dimensions in a nonparametric density estimator, then the following will do that:

n = 400;
sample := RandomVariate[NormalDistribution[], {n, n}];
products = NestList[sample . # &, sample, 2];
data = ReIm /@ Eigenvalues[#] & /@ products;

(* Initial density *)
skd = SmoothKernelDistribution[#, Automatic, {"Radial", "Gaussian"}] & /@ data;

(* Now use the average of the two automatically chosen bandwidths
  as the common bandwidth *)
skd2 = SmoothKernelDistribution[data[[#]], 
  Mean[skd[[#, 2, 3]]] {1, 1}, {"Radial", "Gaussian"}] & /@ {1, 2,  3};

(* Plot results *)
Plot3D[PDF[skd2[[#]], {x, y}], {x, Min[data[[#]]], 
  Max[data[[#]]]}, {y, Min[data[[#]]], Max[data[[#]]]},
  PlotTheme -> "ZMesh", PlotRange -> All, Axes -> False] & /@ {1, 2, 3}

3D smooth PDF's of the first 3 eigenvalues

As a check that the same bandwidths are used for both dimensions:

skd[[1]]

Summary of first pdf

But if the data is invariant w.r.t. rotations around 0 and you have a large sample size, you won't see much difference from what you initially used and what I used above.

$\endgroup$
3
  • $\begingroup$ Underlying density is symmetric w.r.t rotations around 0, so the 3D histogram contours should be perfect circles $\endgroup$ Commented Jul 24, 2023 at 14:39
  • $\begingroup$ Thanks. I clearly misunderstood the question. In that case I would suggest that you only need a single and simpler example: sample = RandomVariate[NormalDistribution[], {n, 2}];. And now to see that I really understand the question: your question is analogous to a 1-dimensional sample where you want to estimate the density from a sample and incorporate the fact that you know the distribution is symmetric about zero but still use a nonparametric density estimator. $\endgroup$
    – JimB
    Commented Jul 24, 2023 at 15:03
  • $\begingroup$ In fact, the approach should then probably be finding a nonparametric density for the distance from zero. In other words, turning this into a 1-dimensional problem. $\endgroup$
    – JimB
    Commented Jul 24, 2023 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.