All Questions
53 questions
2
votes
1
answer
100
views
3
votes
1
answer
239
views
How to use Mathematica to find the maximum expected value of multiple normal distributions?
Is it possible to calculate the maximum expected value of $ n (n\geq 2) $ independent (identical distributed) random variables that follow a normal distribution? If possible, how to find it? If it ...
5
votes
2
answers
693
views
How do you generate a random number with a pre-specified probability distribution?
I want to generate a random real number between 0 and 1 but not distributed uniformly but with a probability distribution say, 2 Sin[ pi x ]^2 which integrates to 1 ...
1
vote
0
answers
67
views
How to generate random points with weight distribution and specific criteria? [duplicate]
Consider some function $f(E_{1},E_{2})$, say
$$
\tag 1 f(E_{1},E_{2}) = \exp[-E_{1}^{3}+E_{2}^{2}]
$$
I want to generate random $n$ points $E_{1}$, $E_{2}$ using this function as weights, with an ...
2
votes
1
answer
61
views
Are there any issues/best practices/suggestions when working with a DataDistribution instead of a distribution?
Suppose there is a random variable $X$ that can take on values $-1,0,1$, with probabilities $P(X=1)=P(X=-1)=.25$ and $P(X=0)=.5$.
How can I work with such a random variable in mathematica? (Find the ...
3
votes
1
answer
194
views
How to generate random variate in custom domain for a distribution?
I have a distribution defined in a particular domain of the variable but now I want to generate a random variable not in the entire domain but only in a subset of the domain. Here is what I'm trying ...
-1
votes
1
answer
105
views
Can the WishartMatrixDistribution command be used for generating random density matrices?
I am interested in generating random members of two classes of $n \times n$ positive-definite matrices $A$ and $B$--the former symmetric in nature, the latter, Hermitian.
The standard (Ginibre-matrix-...
6
votes
1
answer
584
views
RandomVariate cannot sample from a custom multivariate ProbabilityDistribution
Let us try to define 2D distribution through PDF:
...
2
votes
1
answer
103
views
Random Number Generation using LogNormalDistribution
I have a problem that I can't seem to figure out on my own due to limited knowledge of mathematics, and I was hoping I could seek help from the community. I would like to use ...
3
votes
1
answer
253
views
Generate a uniform distribution over an $n$-simplex employing quasi-random low-discrepancy points
This post is intended in a similar direction to an earlier one Can I use Compile to speed up InverseCDF? . I now wish to generate uniform points in an $n$-simplex (specifically $n=8$), making use of ...
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 ...
7
votes
5
answers
1k
views
Survival Probability for Random Walks
The Survival Probability for a walker starting at the origin is defined as the probability that the walker stays positive through n steps. Thanks to the Sparre-Andersen Theorem I know this PDF is ...
2
votes
1
answer
86
views
Drawing random numbers from TransformedDistribution
Suppose I have created the following TransformedDistribution:
...
4
votes
3
answers
876
views
Construct Distribution Histogram From Random Variable
Given a Beta Random Variable $X$ with parameters $\alpha, \beta$ and a positive constant $n$, suppose I am interested in the distribution of:
$$Y:=\lfloor nX\rfloor$$
Suppose I want a histogram ...
3
votes
1
answer
267
views
Generating the cumulative distribution function (CDF) of a tuple made by RandomFunction
I use the RandomFunction to generate a continuous random function (trying to model a rough surface):
...
3
votes
2
answers
664
views
Distribution of Function of Random Sum of Random Variables
Let $ S = \sum_{i=1}^n X_i$ where:
Each $X_i$ is independently 3 or 9 (with equal probability), and
The sample size $n$ is itself an independent random variable where $N \sim \text{NegativeBinomial}(...
3
votes
1
answer
827
views
Simulate random sample from defined probability density function
Suppose I define a function in mathematica that has all of the properties of a valid probability density function. Would it be possible to have Mathematica simulate a random sample of a given size of ...
3
votes
3
answers
147
views
SkewNormalDistribution with a mean value
Since it got incredibly good answers the last time i posted a question, i try it again! ;-)
I programmed a chemical/physical simulation in mathematica, where i can use residence time distribution as ...
1
vote
1
answer
246
views
Modeling Dependent Joint Distribution
I'm trying to model the joint pdf of (X,Y) from example 4.5.8 of the text Statistical Inference 2nd Edition, Casella, Berger (pg 199 of the pdf). Essentially,
X ~ Uniform[0,1]
Z ~ Unfiorm[0,1/10]
Y ...
3
votes
1
answer
476
views
First passage time distribution in mathematica
I'm trying to calculate first passage time distribution for some processes in Mathematica. First I tried to calculate this for Wiener process with zero drift and $\sigma = 1$ and the absorbing ...
10
votes
4
answers
845
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
...
8
votes
1
answer
898
views
How to implement Monte Carlo Importance Sample in 2D or in N dimensions?
So far i have managed to implement the Crude Monte Carlo (CMC) and the Importance Sample Monte Carlo (ISMC) for unidimensional problems.
Consider the function ...
0
votes
1
answer
80
views
Evaluating expression involving a family of probability distributions
I'm trying to use Mathematica to solve a problem involving any continuous probability distribution $F(t)$ such that:
$$\begin{align*}
F(t)&=0, \; t\leq0\\
F(t)&=1, \; t\geq1
\end{align*}$$
...
1
vote
1
answer
147
views
RandomVariate from Multiplying distributions
Mathematica's RandomVariate works fine with the KernelMixtureDistribution[] function, but it doesn't seem to work if you wish to ...
3
votes
3
answers
888
views
Produce a probability vector with uniform distribution [duplicate]
A probability vector is a vector $\mathbf{p}=(p_1,p_2,\ldots,p_n)$ with the following properties:
$\sum_{i=1}^{n}p_i=1$
$p_i\geq 0$
Assume that the set of all possible probability vectors is $\...
4
votes
3
answers
274
views
RandomVariate of ProbabilityDistribution returns values outside the support of a CDF (non-symmetric PDF)
From this post (95069) I can see that this question has been been given a workaround for symmetric PDFs and that the bug was eventually addressed. I checked and the fix is still in place for my ...
1
vote
0
answers
101
views
Mathematica cannot generate the random variables for a given Probability Distribution
I need to generate a large number of random variables from the distribution generated by the following code. Distribution is given by DistributionF. The code is ...
3
votes
1
answer
92
views
7
votes
3
answers
3k
views
How do I define a two point random variable?
How do I define a random variable $X$ such that $Pr[X=x_1]=p_1$ and $Pr[X=x_2]=p_2$ where the values $x_i$, $i=1,\,2$ are just symbols and the probabilities $p_i$, $i=1,\,2$ are symbolic expressions ...
7
votes
3
answers
1k
views
Creating a custom distribution with specified skew and kurtosis
Let's say I want to create a simulated sample of returns for a given investing/trading strategy. I know that my strategy is profitable on 64% of trades, that the ratio of mean win / mean loss is 0.72, ...
2
votes
1
answer
1k
views
How to generate samples from an arbitrary continuous pdf?
If I define an arbitrary pdf p[x_] for a arbitrary-dimensional continuous variable x, how can I use Mathematica to create a function that will return a set of n random samples of x with distribution p?...
0
votes
1
answer
172
views
Draw independent samples from conditional distribution at a fast rate
I would like to draw samples from the following conditional distribution of the following (don't ask why):
...
6
votes
2
answers
903
views
Speed up RandomVariate on a custom probability distribution
I have created a custom probability distribution:
...
7
votes
4
answers
467
views
How to generate two group of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal? [closed]
I want to have two groups of $n$ random numbers $u_i$ and $v_i$ in $U(0,1)$, such that $\sum u_i = \sum v_i$
What I tried is:
I can firstly get $u_i$ by ...
4
votes
1
answer
274
views
Random Variate generating strange results when using ProbabilityDistribution
Bug introduced in 10.1 and fixed in 10.3
I have created a probability distribution that follows a general normal distribution, given by:
$$
\frac{b *e^{-\left(\frac{\sqrt{(x-u )^2}}{a }\right)^{b }}}...
4
votes
2
answers
637
views
Generate a random PDF
How can I generate a random probability density function $p(x)$ in the domain $[0,1]$? Is there a single Mathematica function to do so?
14
votes
3
answers
249
views
10
votes
2
answers
200
views
Possible bug in VonMisesDistribution?
Bug introduced in 10.2 or earlier and fixed in 10.3
Observe:
...
2
votes
0
answers
217
views
Mixture of a bivariate distribution defined as a copula
I define a bivariate distribution:
...
2
votes
0
answers
115
views
Optimization of custom probability distibutions?
Consider the two tests:
Timing[Do[RandomVariate[NormalDistribution[0.5, 0.3]], {200}]]
{0.001188, Null}
...
2
votes
1
answer
203
views
Why is RandomVariate of special probability distribution doesn't working in all cases
I would like to generate a random variates in Mathematica 9 with this distribution:
...
0
votes
1
answer
145
views
Fit process parameters to a transformed AR(1) process
I would like to fit the parameters of an exponented AR(1) process using Mathematica's EstimatedProcess, however, the function does not seem to evaluate to anything.
First of all I create the ...
2
votes
0
answers
403
views
Von Neumann's method to generate points uniformly distributed on a region of a n-sphere surface
I am trying to generate points uniformly distributed on a region of a single n-sphere surface (all angles in hyperspheric coordinates are between 0 and Pi/2).
I decided to use von Neumann's method ...
4
votes
2
answers
770
views
Time inhomogeneous Markov Chain in Mathematica
I would like to create a discrete 2-state Markov process, where the switching probabilities in the transition matrix vary with time.
I can currently do the following, which creates a process with ...
8
votes
1
answer
657
views
Inconsistent DistributionFitTest results?
In pondering this question, I used Mariana's function to generate the following data.
...
7
votes
1
answer
378
views
RandomVariate does not fill range of PDF of distribution
I've declared my own probability distribution as follows
dist[a_, b_] := ProbabilityDistribution[Cos[(b x)/2]^2 Sinc[a x]^2, {x, -400, 400}];
When I try to ...
1
vote
1
answer
326
views
Safe values of $\mu$ and $\sigma$ when randomly sampling from a Log-Normal Distribution?
I believe I'm obtaining overflow errors when randomly sampling from a log-normal distribution with the command:
RandomVariate[LogNormalDistribution[μ, σ], 1]
...
2
votes
0
answers
1k
views
Calculate variance of random walk?
How can I symbolically calculate the variance of the following random walk in Mathematica?
Given several discrete random variables such that $p(Z_i=1-2k)=p$, where $k$ is a small real number, and $p(...
22
votes
2
answers
2k
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 ...
16
votes
1
answer
470
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}]
...