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.

Filter by
Sorted by
Tagged with
50 votes
8 answers
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: ...
user avatar
  • 3,720
49 votes
3 answers
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. ...
user avatar
  • 3,051
33 votes
2 answers
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 ...
user avatar
  • 1,005
30 votes
4 answers
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 ...
user avatar
  • 301
25 votes
2 answers
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 ...
user avatar
24 votes
4 answers
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? ...
user avatar
  • 1,165
24 votes
3 answers
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 ...
user avatar
  • 371
22 votes
2 answers
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 ...
user avatar
  • 321
22 votes
1 answer
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 ...
user avatar
21 votes
5 answers
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 ...
user avatar
  • 665
21 votes
3 answers
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. ...
user avatar
19 votes
2 answers
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$ ...
user avatar
19 votes
1 answer
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: ...
user avatar
  • 25k
18 votes
3 answers
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 ...
user avatar
  • 2,206
18 votes
1 answer
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 ...
user avatar
  • 8,588
17 votes
4 answers
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. ...
user avatar
  • 2,595
17 votes
3 answers
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 ...
user avatar
16 votes
3 answers
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: ...
user avatar
  • 399
16 votes
1 answer
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}] ...
user avatar
  • 8,441
16 votes
2 answers
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: ...
user avatar
  • 1,473
14 votes
5 answers
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/...
user avatar
  • 11.4k
14 votes
1 answer
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?
14 votes
1 answer
3k views

Probability and distribution from actual data

Let's say I have some data from a real world system: ...
user avatar
  • 10.6k
14 votes
2 answers
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 ...
user avatar
  • 9,472
14 votes
3 answers
242 views

Strange behavior of RandomVariate for Binomial distribution?

Observe: ...
user avatar
  • 25k
13 votes
2 answers
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: ...
user avatar
13 votes
2 answers
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 ...
user avatar
  • 467
13 votes
5 answers
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 ...
12 votes
3 answers
569 views

DistributionChart range extends beyond the data itself

I have a larger data set and want to display it using DistributionChart. ...
user avatar
  • 1,292
12 votes
2 answers
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: ...
user avatar
  • 5,182
12 votes
1 answer
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 ...
user avatar
  • 5,182
12 votes
2 answers
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)$ ...
user avatar
  • 565
12 votes
2 answers
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 ...
user avatar
12 votes
1 answer
274 views

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

I am puzzled because this toy example (in Mathematica 8) ...
user avatar
11 votes
3 answers
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$,...
user avatar
  • 3,077
11 votes
3 answers
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 ...
user avatar
  • 503
11 votes
2 answers
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 ...
user avatar
11 votes
2 answers
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 ...
user avatar
11 votes
1 answer
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 ...
user avatar
11 votes
1 answer
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) ...
user avatar
  • 12.3k
10 votes
4 answers
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 ...
user avatar
10 votes
3 answers
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 ...
user avatar
  • 345
10 votes
4 answers
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 ...
user avatar
  • 101
10 votes
3 answers
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 ...
user avatar
10 votes
2 answers
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 ...
user avatar
10 votes
2 answers
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 ...
user avatar
  • 1,002
10 votes
2 answers
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. ...
user avatar
10 votes
2 answers
195 views

Possible bug in VonMisesDistribution?

Bug introduced in 10.2 or earlier and fixed in 10.3 Observe: ...
user avatar
  • 25k
10 votes
1 answer
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 ...
user avatar
  • 224k
10 votes
4 answers
991 views

Conditional Expectation -- How can Mathematica find a more general closed form?

Mathematica can't find a solution to this Expectation. ...
user avatar

1
2 3 4 5
16