All Questions
Tagged with distributions random
101 questions
0
votes
0
answers
21
views
Simulating data from a piecewise pdf occasionally returns an error [duplicate]
In the following code, I generate data from a piecewise PDF. Usually, I get a sample size of ns, but sometimes I get an error message:
Error: RandomVariate::unsdst:...
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 ...
1
vote
1
answer
133
views
How to quickly sample from the following distributions
Consider the following distributions:
...
0
votes
0
answers
42
views
Combinations of distributions to be called with `RandomVariate`
I'd like to manipulate distributions that I'm going to retrieve using RandomVariate; e.g., I would like to take
...
1
vote
1
answer
98
views
How can I calculate the moments of a truncated random variable?
I am using the Moment function to calculate the moments of an exponential random variable.
as follows,
Moment[ExponentialDistribution[3], 9]
However, I need to ...
4
votes
1
answer
74
views
Speeding up RandomVariate with custom probability distribution
I have the defined a custom distribution, which is a Gaussian where the exponent can be any real n greater than 0 (set to actually be >0.5 in use), i.e.
...
0
votes
1
answer
94
views
How to generate random value under the given distribution fast?
Consider a distribution
distr[EN_, Enu_, mN_] =
Exp[-(Sqrt[EN^2 + mN^2]/Enu)]*Sqrt[(Sqrt[Enu^2-mN^2]/2)^2 - EN^2] Sqrt[
EN^4 - (Enu/4)^4]
where mN is a free ...
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 ...
0
votes
2
answers
163
views
How to generate random dots with given distances?
I am interested in the following problem, and am curious if Mathematica could be used to solve it.
I start with a radius function $\rho:D\to \mathbf{R}_{\ge 0}$ on a region $D\subseteq \mathbf{R}^n$. ...
0
votes
1
answer
84
views
Is there a difference between generating and loading data?
EDIT-1
This is a minimal example where an error occurs after 44538 samples generated in d1 upon importing as d2. Note that if <...
1
vote
1
answer
162
views
A very basic question about weighted data
I have a dataset in the form
{{A1,B1,C1,...},{A2,B2,C2,...},...}
and the weights in the form
{w1,w2,w3,...}
Having this ...
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
vote
1
answer
70
views
distribution implement for RandomVariate
I have a scalar function of two random matrices of dimension $n$ which are in the Gaussian Unitary Ensemble
$$f(x,y) \in \mathbb R, \quad x^{\dagger}=x \: \operatorname{and} \: y^{\dagger} = y, \:\...
4
votes
2
answers
190
views
Maximum of all distances between any pairs of vertices of a random triangle
Given a set $S_n$ of $n$ points selected uniformly at random in a $d$-ball, I want to estimate the average length of the longest side of a triangle having as vertices any three distinct points of $S_n$...
-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-...
7
votes
1
answer
393
views
How to distribute points on a Sphere[] cap from a normal distribution?
I was wondering if one could distribute points on a "cap" of a sphere, following a normal distribution of the points instead of a uniform distribution. This normal could be centered at the ...
6
votes
1
answer
584
views
RandomVariate cannot sample from a custom multivariate ProbabilityDistribution
Let us try to define 2D distribution through PDF:
...
1
vote
1
answer
38
views
Can I sample from a distribution whose parameters depend on the current iteration?
Let's say I want to sample from 100 Beta distributions, and in each successive one, the first parameter increases by 1. So given a current iteration number n, I ...
0
votes
1
answer
183
views
Sampling two integer lists of given sizes from a distribution that have equal sums
(This question emerged from discussions in this post.)
Context and code sample:
I am trying to figure out if there is a way to generate two $a$ and $b,$ comprised of $n_a$ and $n_b$ integers which ...
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 ...
2
votes
1
answer
372
views
RandomReal in combination with NormalDistribution [closed]
I am normally not working with Mathematica, but I have to understand a code written in i!
Can some body say what the arguments and parameters of code below say?
...
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 ...
1
vote
2
answers
195
views
Sampling data from numerical values of density distribution of nucleons
How could i sample my data which follows distribution if i have only numerical values of density distribution as an example data attached as in picture
I tried but do not know how to do it.
The data:...
2
votes
1
answer
86
views
Drawing random numbers from TransformedDistribution
Suppose I have created the following TransformedDistribution:
...
2
votes
1
answer
151
views
Random points from an image using a BernoulliDistribution
I am a Mathematica newbie. I need to sample random points from an image which I have stored in a variable img as:
...
0
votes
1
answer
173
views
Negative values with RandomVariate
I am using the following code to generate some random number from a custom distribution:
...
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 ...
4
votes
2
answers
173
views
Optimize RandomVariate for a $1/x^4$ distribution
I'm working with the following code, where I define a probability distribution proportional to $1/x^4$.
...
7
votes
2
answers
2k
views
Can this code be changed to run faster?
I've worked for several days trying to get this code to run faster. The imported data is 15MB.
...
5
votes
1
answer
79
views
Random normalised variable generation
I want to generate 8 random variables (in reality to form 4 complex numbers) such that the sum of the 8 variables squared is equal to unity. The aim of generating such numbers is to perform a quantum ...
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
475
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
...
1
vote
1
answer
92
views
How to generate number of points in a m/m/c/c process with Poisson arrival and exponential service time?
I am considering the Earling-B or m/m/c/c process.
Let the request arrival rate follows Poisson Process with average rate, $\lambda$
Let the service time follows Exponential Distribution, i.e., $\...
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 ...
0
votes
0
answers
118
views
Generate random numbers for each time-step that are correlated
I want to generate Gaussian distributed random numbers, but i want them to be correlated, e.g $E[\epsilon(t)\epsilon(t')]=C(t-t')$ where $C$ is some function and $E[\cdot]$ denotes the expectation ...
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 ...