Tag Info

New answers tagged

0

It makes sense that Quantile shouldn't work with any multivariate distributions. Effectively Quantile uses the Inverse CDF which cannot exist for multivariate distributions, since you can produce an infinite number of rectangles or other shapes around the median (or mean) point which contain $q$% of the probability mass. Inverse CDFs only can exist in 1D ...


13

Update Silvia proposed a much faster algorithm that I believe produces I uniform distribution. Here is my implementation of it. pointsInMask2[mask_Image, n_Integer, range : {_, _} : {0, 1/2}] := Reverse @ ImageData @ Binarize[mask, range]\[Transpose] // SparseArray[#]["NonzeroPositions"] & // RandomChoice[#, n] + RandomReal[{-1, 0}, {n, 2}] ...


10

Following up on my comment and borrowing a method from Vectorizing an image like "Trace Bitmap" in Inkscape: mask = Binarize @ Import["http://i.stack.imgur.com/yoPNX.png"]; {row, col} = ImageDimensions[mask]; intf = ListInterpolation @ Reverse @ ImageData @ mask; region = DiscretizeGraphics @ RegionPlot[intf[c, r] < 1/2, {r, 1, row}, {c, ...


3

In version 10.1 the undocumented function Random`RandomPointVector is useful: region = DiscretizeRegion@RegionUnion@ Table[Disk[RandomReal[4, {2}], RandomReal[1]], {10}]; Graphics@Point@ Random`RandomPointVector[region, 1000, Automatic, Automatic] The two Automatic arguments appear to be working precision and a method option - other allowed values ...


4

It turns out this was a bug with version 10.0.2 of Mathematica. Upgrading to 10.1.0 resolved the issue and Mean@distInv now returns infinity.


0

If m is a known value, then the method of moments only requires the sample mean and sample variance to be equated to the mean and variance of the distribution (and one can have weights 1/2 by using w as the weight for the values of x < m: (* Weight *) w = 1/2 (* Mean *) mean = FullSimplify[ Integrate[w a x Exp[a (x - m)], {x, -Infinity, m}, ...


0

RandomVariate[NormalDistribution[0,1]] If you want 10 such numbers: RandomVariate[NormalDistribution[0, 1], 10] Answering the question below: RandomVariate[TruncatedDistribution[{0, 1}, NormalDistribution[0, 1]], 12]



Top 50 recent answers are included