# Questions tagged [distributions]

For questions about distributions built-in in Mathematica, and functions that operate on them. Also includes questions about defining your own distributions.

762 questions
Filter by
Sorted by
Tagged with
7k views

### How to generate random points in a region?

The Mathematica 10 documentation was updated for FindInstance adding support for regions. In my use case, I'm trying to sample points in a set of disks: ...
• 3,720
5k views

### RandomVariate from 2-dimensional probability distribution

A probability distribution can be created in Mathematica (I am using 8.0.1) with e.g. ...
• 3,051
1k views

### Huge bug involving MultinormalDistribution?

Bug introduced in 8.0 and fixed in 11.1 I found a strange behavior regarding the CDF of the bivariate Normal distribution ...
• 1,005
5k views

### Standard errors for maximum likelihood estimates in FindDistributionParameters

I am trying to fit a non-standard PDF to data and FindDistributionParameters works great, and gives me the parameters of the distribution back using maximum ...
• 301
1k views

### Given an exact formula, how can Mathematica find a probability distribution whose PDF matches it?

So, given some data, Mathematica 10.2 can now attempt to figure out what probability distribution might have produced it. Cool! But suppose that, instead of having data, we have something that is in ...
• 2,962
7k views

### Visualization of Bivariate Distributions

I know it is perfectly possible to show the bivariate probability distributions in MMA. But my question is can we show each dimension of distribution in 2D dimension while we are showing the 3D plot? ...
• 1,165
12k views

### How to generate a RandomVariate of a custom distribution?

I'm trying to generate a pseudorandom variate out of a custom distribution. Suppose I want define a custom distribution, and for the sake of simplicity I define a Poisson distribution (the ...
• 371
1k views

### Efficient Generation of Random Variates from a Copula Distribution

I have a 7-asset portfolio for which I want to simulate daily log-deltas using a Student T copula. The marginal distributions are all either Stable or TsallisQGaussian. Using NMaximize, I have ...
• 321
2k views

### Backtesting a Probability of Default (PD) model

Background PD models Financial institutions use Probability of Default (PD) models for various purposes such as client acceptance, provisioning and regulatory capital calculation as required by the ...
• 64.4k
1k views

### Sisyphus Random Walk

A Sisyphus Random Walk evolves as follows: With probability (r) you advance the position of the walker by +1. With probability (1-r) the walker resets at x0 = 0. To simulate the probability of reset ...
• 665
676 views

### More efficient method to compute moments of the Johnson $S_B$ distribution

Here is a very specific feature request. I need Mean[JohnsonDistribution["SB", γ, δ, 0, 1]] When I issue e.g. ...
• 2,037
3k views

### Obtaining joint distributions and conditional distributions using Mathematica

I have two multivariate Gaussian distributions $p(x)$ and $p(z)$ with mean vectors $m_x$ and $m_z$, and covariance matrices $\Sigma_x$ and $\Sigma_z$. my model is a simple linear model $x = W z+n$ ...
281 views

### Possible bug in OrderDistribution? [Update: Confirmed by Wolfram Research and enqueued.]

Bug Introduced in 11.3 or earlier Initial testing indicates this has been addressed in 12.0 Observe: ...
• 25k
2k views

### Generating uniform random points over a binary image

So I recently read this excellent post about generating random points over arbitrary regions. I hope Wolfram eventually builds that functionality into Mathematica's ...
• 2,206
2k views

### Speed up adding Poisson noise to an image

I'm simulating some images corrupted with Poisson noise, but I'm encountering a few problems with performance. According to the documentation on ImageEffect, one ...
• 8,588
1k views

### Does Mathematica have an implementation of the Poisson binomial distribution?

I need to work out the probability of having $k$ successful trials out of a total of $n$ when success probabilities are heterogeneous. This calculation relates to the Poisson Binomial Distribution. ...
• 2,595
4k views

### Finding distribution parameters of a gaussian mixture distribution

Short version: how to estimate the parameters of a mixture of multivariate normal distributions (i.e.: Gaussian mixture model)? Long version. I am trying to estimate the parameters of a mixture of ...
5k views

### How do you draw credible regions/intervals on a 2D PDF?

I have some numerical data from which I generate a PDF via: pdf = HistogramDistribution[data]; Which can then be easily visualised thus: ...
• 399
464 views

### RandomVariate returns values outside the support of a PDF

Bug introduced in 8.0.1 and fixed in 10.2.0 Let $X$ be a random variable with pdf: dist = ProbabilityDistribution[1/(Abs[x]*Log[Abs[x]]^2), {x, -E^-2, E^-2}] ...
• 8,441
2k views

### How to compute the inverse CDF of HyperbolicDistribution properly?

Fixed in version 9. I want to compute the CDF and inverse CDF of the hyperbolic distribution: ...
• 1,473
1k views

### How to plot paired smooth histogram/distribution plots?

I've been trying to get paired distribution (aka "violin") plots like those shown below for a few hours, but all my attempts have failed. The key features here are paired smooth histograms/...
• 11.4k
2k views

### Is there a free version of the Springer book "Mathematical Statistics with Mathematica"?

Is there a free version of the Springer book: $$\text{Mathematical Statistics with Mathematica}$$ by Rose and Smith ... available on the internet?
3k views

### Probability and distribution from actual data

Let's say I have some data from a real world system: ...
• 10.6k
1k views

### Compiling the VoigtDistribution PDF

According to List of compilable functions, Erf and Erfc are compilable functions. However, I want to make a compiled version ...
• 9,472
242 views

Observe: ...
• 25k
7k views

### What is the best distribution for my histogram?

I defined a security bound for a random walk (cube with 15 length) and I have this code to obtain a sample of the random times at which the random walk crosses the boundary for the first time: ...
814 views

### What do the options of SmoothKernelDistribution do?

The function SmoothKernelDistribution has three options that are not described in too much detail in the Mathematica's help window. InterpolationPoints: What is ...
• 467
746 views

### Frequency of punctuation characters used in Mathematica languages

I would like to determine the computer language character frequency in Mathematica code. I want to remap my keyboard to the most used character such as [], {}, -, +. There are the frequency of ...
569 views

### DistributionChart range extends beyond the data itself

I have a larger data set and want to display it using DistributionChart. ...
• 1,292
2k views

### How to implement Kullback-Leibler divergence using Mathematica's probability and distribution functions?

Last year Jens answered a question about how to implement Kullback-Leibler divergence in the discrete case. He gave this answer: ...
• 5,182
762 views

### Update: Combining DistributionChart and BoxWhiskerChart

Goal The goal is to merge the default styles of a few different charts; namely, to have a chart that: has the key components of BoxWhiskerChart the outline of the ...
• 5,182
537 views

### Sampling a phase space uniformly for a given energy?

The energy for a 1D harmonic oscillator can be written: $$E = \frac{1}{2 m} p^2 + \frac{m \omega^2}{2} x^2$$ where x is position and p is the momentum. I would like to sample phase space $(x,p)$ ...
• 565
1k views

### How to define a new copula distribution family

The function CopulaDistribution can be used with the most well known kernels. I was wondering how I can add a new family of kernels in a way that it works in the ...
274 views

### How does bandwidth selection work for low-variance dimensions with KernelMixtureDistribution?

I am puzzled because this toy example (in Mathematica 8) ...
722 views

### Deriving a PDF for an annulus distribution

I would like to derive the PDF for an ''annulus'' type distribution, defined by the parameters $\theta\sim U(0,2 \pi)$ and $d\sim N(0,\sigma)$; where $\theta$ is the angle round a circle of radius $r$,...
• 3,077
1k views

### The default bandwidth of the SmoothKernelDistribution function

I am researching the Silverman rule of thumb for bandwidth selection. Below is a sample of my code, from which it seems that BW=63 is close to the default parameter given by Mathematica (2 images are ...
• 503
2k views

### Histogram "PDF" vs "Probability"

I have a discrete random variable with values from $0$ to $100$. I have plotted its histogram with bars centered in $0, 5, 10,\dots,100$. First I made the histogram using the ...
• 579
2k views

### Trying to fit an unknown extreme distribution

First up, I'm quite new to Mathematica so any hints on better code would be greatly appreciated. I have some histogram frequency data from an unknown distribution that I'm trying to fit. Here's the ...
• 211
411 views

### How does LocationTest choose its "AutomaticTest"?

Is there a way of determining how LocationTest chooses its "AutomaticTest"? Sometimes it's clear from the ...
• 5,881
501 views

### Problems encoding a Bayesian Network when using MultinomialDistribution

Short description of the encountered problem I am getting an error when using a MultinomialDistribution to encode a conditional probability distribution (CPD) ...
• 12.3k
459 views

### The sampling without replacement

I have an EmpiricalDistribution d = EmpiricalDistribution[{1, 1, 1, 2, 2, 2, 3, 3, 3, 3}] now, I want to sample twice ...
• 585
3k views

### Ηow to create an interpolated CDF from its samples?

I want to use a distribution I have only aggregate statistics on, namely its CDF sampled at certain points. I would like to keep it "nonparametric" (remain noncommittal on the parametric form), but I ...
• 345
805 views

### Uniform distribution on z = 1 − √( x ^2 + y ^2) , z ≥ 0 [duplicate]

Let $S$ belong to ${\rm I\!R^3}$, $z = 1 − \sqrt{x^2 + y^2}$ , $z ≥ 0$. I need to write a program that generates a random point on $S$ with uniform distribution. I've tried to use ...
• 101
717 views

### Can I use Compile to speed up InverseCDF?

I'm repeatedly issuing the command P = InverseCDF[NormalDistribution[0, 1], T] where T is either a 36- or 64-vector of real numbers (points in the unit ...
• 2,215
1k views

### Selecting a random subset to match PDF of another or a given distribution

Problem definition: I have a list of patient records from a hospital, who are of a certain distribution of ages. I want to randomly sample patients from this list in such a way that their age ...
• 1,350
1k views

### Finding a distribution to fit truncated data

I have certain experimental data with the following PDF. As you may note the data does not take values lower than 0. Using FindDistribution I get the following ...
• 1,002
177 views

### Probability: MultivariateHypergeometricDistribution broken with more than five categories?

2016-04-09: This bug is indeed fixed (thank you, Stefan R.!) in 10.4. It may have been fixed in 10.3 or 10.3.1, but I haven't tried these versions. ...
• 711
195 views

### Possible bug in VonMisesDistribution?

Bug introduced in 10.2 or earlier and fixed in 10.3 Observe: ...
• 25k
1k views

### How can we create a histogram distribution from binning data?

HistogramDistribution takes a list of data points, creates a histogram from them, and returns this histogram in a form that can be used as a distribution. I ...
• 224k