5

Use a normal distribution to generate $n$ values and Normalize to get a point on the sphere. Make sure that the last coordinate always has the same sign using Abs. Generate millions of these points and estimate the mean distance between pairs: n = 3; topt[p_] := MapAt[Abs, Normalize[p], -1] points = topt /@ RandomVariate[NormalDistribution[0, 1], {1000000, n}...


4

Maybe SeedRandom[1] n = 300; d = 30; p = RandomPoint[Sphere[d], {n, 3}]; xyz = Apply[EuclideanDistance, Subsets[#, {2}] & /@ p, {2}]; Mean[Map[Max, xyz]] 1.5164 If we use Ball[d] instead of Sphere[d] we get 1.47179. And a modification of your code (eliminating repeated invocations of Subsets[#,3] on p): SeedRandom[1] n = 300; d = 30; p = ...


3

Seems no so effective. Here we use RandomPoint to select uniform points in Ball[] and use RandomSample to select three points to construct a random triangle. SeedRandom[1]; n = 300; d = 30; pts = RandomPoint[Ball[d], n]; Table[Max @@ EuclideanDistance @@@ Subsets [RandomSample[pts, 3], {2}], {i, 200000}] // Mean 1.46926


3

Not an exact answer but a Monte-Carlo way of checking the exact answers. Generate a random point on the unit $n$-sphere: P[n_Integer?Positive] := Normalize[RandomVariate[NormalDistribution[], n]] Measure the mean distance between a random point $P_0$ and another random point on the unit $n$-sphere, by averaging over $m$ random points: M[n_Integer?Positive, ...


2

For $n=3$: The PDF is $f(d) = d/2$ or in Mathematica TriangularDistribution[{0, 2}, 2] - a ramp shaped distribution. We can test this numerically and we get a high $p$-value of about 0.31 so it's a good fit: points = RandomPoint[Sphere[], {1000000, 2}]; distances = EuclideanDistance @@@ points; testdist = TriangularDistribution[{0, 2}, 2]; ...


2

Mathematica often pre-Standardize's data before learning. For example, see my answer here about learning SVM hyperplanes where I also encountered this problem. Therefore things are a bit more involved than my comment about the documentation if you want to extract the right parameters. I hope you can follow along: (* some sample data, learn a 3 component ...


2

Another way to do the sampling (taking advantage of the built in Sphere function and RandomPoint functionality (modified from a similar question on sampling from the surface of the sphere distanceDistributionOnHalfSphere[dimensionality_, nSamples_:10^5] := With[{ (* take a few extra samples account for loss *) randomPointsOnSurfaceOfNSphere = ...


1

Clear["Global`*"] GeometricDistribution is built-in dist[p_] = GeometricDistribution[p]; PDF[dist[p], x] (* Piecewise[{{(1 - p)^x*p, x >= 0}}, 0] *) CDF[dist[p], q] (* Piecewise[{{1 - (1 - p)^(1 + Floor[q]), q >= 0}}, 0] *) DistributionParameterAssumptions[dist[p]] (* 0 < p <= 1 *) Random samples from the distribution can be ...


1

RandomPoint can be used to sample from arbitrary Region definitions, and Sphere describes the unit sphere in $R^n$ (it can be both a geometric region and a graphics primitive). So @flinty's original solution can be generalized to arbitrary numbers of dimensions. Using this type of approach avoids having to know very much about the problem (as in @Roman's ...


1

We had a discussion and we came to the conclusion (I think) that what was needed was a "mixed model" rather than a "mixture model". A simplified definition of a mixed model is a regression with more than one error term (resulting in some observations being correlated with other observations). Mathematica does not currently offer a ...


1

While the estimation process will process any dataset and real datasets never really match the what the model expects, the dataset you created isn't a mixture distribution in the usual sense in that you have the counts of each subpopulation fixed. In a standard mixture distribution, the counts of each subpopulation will vary. To generate data for your ...


1

With[{sigma = 15, mu = 0}, t = Table[E^(-(x - mu)^2/(2 sigma^2)), {x, -50, 50}]; ListPlot[# Rescale[t] & /@ {5, 10, 15}, PlotRange -> Full, Filling -> Bottom, DataRange -> {-50, 50}]] Alternatively, With[{sigma = 15, mu = 0}, t = Table[{x, E^(-(x - mu)^2/(2 sigma^2))}, {x, -50, 50}]; ListPlot[ScalingTransform[{1, #}][t] & /@ {5, 10,...


Only top voted, non community-wiki answers of a minimum length are eligible