Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [random-generation]

The act of generating a sequence of numbers or symbols randomly, or (almost always) pseudo-randomly; i.e., with lack of any predictability or pattern.

0
votes
2answers
15 views

High-accuracy RNG

I need to simulate a sample of size 100x3 of white noise (normal with null mean and unitary variance) I'm actually using Mersenne-Twister but discussing with my Professor seems is not "very stable" ...
0
votes
1answer
25 views

Trying to Understand the Statistical Notation [on hold]

Does x need to be randomly sampled from a normal population and what is d?
0
votes
0answers
31 views

Getting sets of random correlated variables

For the training of a machine learning model I need to add additional features, and these features are correlated. I need to run the model N times adding these features with random values, and for ...
0
votes
0answers
24 views

Why is my set.seed in R and RStudio giving diffirent results [on hold]

I was trying to use a seed for a sampling problem but I kept getting the wrong result using R studio. I tried it by simply opening R and I got what I was looking for. Why is this? What is wrong, and ...
1
vote
0answers
11 views

Reducing estimation noise from several random draws

I was reading a paper in connection with preparing my thesis defense, where I stumbled upon a methodologic choice that I cannot fully understand. For context, assume a group of 16 firms exists. The ...
0
votes
0answers
20 views

Can I increase the sample size by generating random numbers to apply the Chi-Square Goodness of Fit Test?

Does increasing the sample size by random number generation change the distribution? I have a sample of size 8. Each sample value represents the number of bus arrivals at a bus stop every 15 minutes. ...
2
votes
1answer
22 views

Proper way to generate random seeds for Montecarlo runs [closed]

I am running a SIMULINK model which has noise additions. At this moment we have a variable called seed which is initialized at zero. seed = 0; Then for every ...
0
votes
0answers
9 views

How to check if a sequence's subsequences (trigrams) are random using a Monte Carlo experiment?

Let's say I have a process that produces sequences. I might have another process (or processes) that will add their own output to the data sequences at random points. To check if a subsequence (any ...
0
votes
0answers
33 views

Is pseudorandom number generator testing atypical?

Particular pseudo-random number generators are tested for their their ability to produce sequences of numbers that behave like values of independent variables that are each uniformly distributed on [0,...
1
vote
1answer
36 views

Re-scaling of exponentially distributed random numbers

I am trying to generate $M$ random numbers which are exponentially distributed and whose sum adds up to $N$ (for simplicity, $N=1$). I found that the generated numbers are initially exponentially ...
1
vote
1answer
44 views

How to check if a distribution is different from uniform distribution using the values only?

I have a discrete empirical distribution, where the values D1 = {1,2,3,7,9,15,16,17,18,19,20} occurs with some different frequencies. The frequencies are not of interest to me. I am interested in how ...
1
vote
0answers
26 views

How to get a random function with a truncated normal distribution? [duplicate]

My goal is to have a function that given an input value will output a random value that follow a truncated normal distribution, could you please suggest a function that can do that ? Or guide me a ...
0
votes
1answer
65 views

How to choose the best method to generate random values [closed]

In my specific case, I have a pdf that has no closed form, and I want to generate random values ​​of this distribution. It depends on a summation that goes to infinity (coming from a poisson process) ...
1
vote
1answer
18 views

Using quantiles to generate a sample of data

I have been given quantiles (min, 25%, med, 75%, max) for items of data, along with the size of the data n. From these pieces of information I would like to obtain a random sample of data points. ...
2
votes
1answer
25 views

Optimal distribution for Acceptance Rejection Sampling

For some project I have been sampling from the Gamma distribution. I have been using the exponential distribution intensively. One method I have employed is the Acceptance rejection sampling, ...
2
votes
0answers
21 views

How do I generate a random variable whose CDF is the product of given CDFs?

I am looking at a finite set of independent random variables ${\left\{ {{X_i}} \right\}_{1 \le i \le n}}$ with CDF ${F_i}$, with the aim of generating a random variable such that it has the CDF ${G_1}(...
16
votes
4answers
274 views

Draw integers independently & uniformly at random from 1 to $N$ using fair d6?

I wish to draw integers from 1 to some specific $N$ by rolling some number of fair six-sided dice (d6). A good answer will explain why its method produces uniform and independent integers. As an ...
3
votes
1answer
47 views

How to generate a data sample along a annulus (between fixed radii)? [duplicate]

I would like to create a random data sample to test a clustering algorithm using python. One specific data sample I would like to generate consists of two non-overlapping annuluses (annuli?); however, ...
1
vote
1answer
27 views

Generating three random numbers from normal distribution using 3 independent uniform numbers

Each of the variables A,B,C follows a normal distribution with E(A)=E(B)=E(C)=1,V(A)=1,V(B)=2,V(C)=4. Correlation between A-B=0.2,B-C=0,AC=0.8. We are given three independent uniform (on[0,1]) random ...
2
votes
1answer
36 views

wigner semi-circle distribution random numbers generation

I am trying to generate random numbers in Wigner semi-circle distribution. Since this one does not have the analytical solution for the inverse function of the pdf. I wonder if anyone familiar with a ...
1
vote
1answer
59 views

Generating multivariate normal random variables only using unif

How can I generate n multivariate normal random variables only using the runif function (with mu and sigma). I know how to use box muller transformation, but not sure where to go from there once ...
1
vote
1answer
43 views

Books for self-learning about statistic Simulation?

Preferably an introductory book, i.e. for undergrad (or notes or something like that) that explains concepts with detail and with lots of examples, without losing the formality. That covers the ...
1
vote
1answer
16 views

Randomly choosing objects from a set of objects - guarantee all objects are picked at least once?

I got into a debate with someone in class over an experiment that was claimed to be randomized. The experiment was such that there is a bucket of distinct objects, and objects were being "randomly" (...
0
votes
0answers
147 views

Simulate data that arise from mediation with specified conditions

I am looking to create a function that simulates data arising from a mediation process, where a predictor (X) has an indirect effect on the outcome (Y) through the mediator (M). I consulted the ...
1
vote
1answer
23 views

Random draw from a linear model

I'm building an individual-based model where one component includes increasing winter temperature over time (years). For each iteration of the model (say 1000 iterations that have 25 years each) I ...
2
votes
0answers
19 views

Probability of matches being random

We have a set of 576 samples that have been assayed to obtain some omics information (genomic/epigenomic). The 576 samples are mostly from unique individuals, but we have some samples for which the ...
3
votes
1answer
201 views

How does the Metropolis Algorithm “get off the ground”?

I'm thoroughly confused by the Metropolis Algorithm as defined in Casella and Berger's Statistical Inference. Namely, here's the definition (p.254): Let $Y \sim f_Y(y)$ and $V \sim f_V(v)$, where $...
2
votes
1answer
47 views

What property must a RNG have to be used in Monte Carlo simulations?

For example, every cryptographically secure pseudo-random number generator (CSPRNG) is required to satisfy the next-bit test and withstand "state compromise extensions". This makes me wonder what ...
0
votes
1answer
54 views

How to calculate number of solid color images on the screen of random pixel generator?

Is there a statistical formula/function to calculate number of basic geometric shapes on the displays of random pixel generator? Let's say we have a basic random pixel generator which has 10*10 ...
2
votes
0answers
38 views

How to find the distance confidence between the sum of random variables and a given target value?

Given a distribution $X$($E[X]$, $Var[X]$) and a target value T, I am wondering whether there is a bound on $P(|\sum_{i=1}^{i=N}X_i - T| < \epsilon)$. For example, $P(|\sum_{i=1}^{i=N}X_i - T| &...
0
votes
1answer
26 views

Permutations, shuffling WITHIN but not BETWEEN groups [closed]

In R, I need to make 100 repeat random permutations of group orders, keeping the composition and sizes of groups the same, but the order within the groups needs to be randomly shuffled (100 times) By ...
0
votes
0answers
16 views

How can I map a Gaussian vector according to an equation that has a spatial autocorrelation function?

I have the following function: $E(x,z)=30-0.5z+12.5\frac{e^{Y(x,z)}-e^{0.5}}{\sqrt{e^2-e}}$ I want to run some Monte Carlo simulations and at each simulation I have to generate values for $E$ at ...
0
votes
1answer
40 views

Statistical Reasoning of Noise Images on Random Pixel Generator

http://www.pixelmonkeys.org/#theory It is always explained that even billions of images are generated per second, it is almost impossible to see a natural image ( whether it is clear or distorted as ...
0
votes
1answer
110 views

Simulate from a mixture of two beta distribution [closed]

I have this distribution : $X \sim 0.75\mathcal{B}e(\alpha_{X_1}=1,\beta_{X_1}=3)+0.25\mathcal{B}e(\alpha_{X_2}=5,\beta_{X_2}=1.75)$ where the density function is given from this function: ...
19
votes
3answers
3k views

Finding a way to simulate random numbers for this distribution

I am trying to write a program in R that simulates pseudo random numbers from a distribution with the cumulative distribution function: $$F(x)= 1-\exp \left(-ax-\frac{b}{p+1}x^{p+1}\right), \quad x \...
2
votes
2answers
43 views

Normal distributed random variables with constraint?

Consider $n$ random variables $X_i$ with $i=1,2,...,n$, each drawing values from identical normal distributions with mean $\mu=0$ and standard deviation $\sigma=const.$ so that expectation values are $...
2
votes
0answers
30 views

How to generate samples from joint distribution of normal and logistic with R?

How to generate triple data $(Y,R,X)$ with R code satisfying following restrictions: $X \sim N(0,1)$, $R$ is binary and $P(r=1\mid y=0,x) = expit(\alpha_0+\alpha_1 x)$. $Y$ is continuous and $Y\mid r=...
1
vote
1answer
15 views

Is there a term for a random sequence of integers with every consecutive pair in the sequence being unequal?

I'm trying to generate a random sequence of integers whereby no two consecutive values are equal to each other. This sequence is meant to simulate changes in state only. Is there some term or concept ...
6
votes
1answer
462 views

How to generate samples of Poisson-Lognormal distribution

I would like to compute samples of the number of product purchased in a supermarket. I want to model it with a mixed Poisson lognormal distribution. Items purchased $x$ of a given consumer follow a ...
2
votes
0answers
47 views

Generating Correlated Random Variables following Weibull Distribution

I am working on analyzing power generation from geographically distributed wind farms. I have wind speed data that have been collected at multiple locations, but the measurement periods for different ...
1
vote
0answers
161 views

How to sample from a multivariate uniform distribution with constrained sum [closed]

Problem description: Let say that we have the following 4 uniform distributions: $u_1$~$U_1(-1, 1), u_2$~$U_2(0, 2)$, $u_3$~$U_3(0, 0.2)$ and $u$~$U[U_1, U_2, U_3]$ subject to $u_1 + u_2 + u_3 = 1$. ...
1
vote
1answer
55 views

How to generate increasing (then decreasing) numbers with variance R [closed]

I have to generate numbers which increase and decrease, with variance in them. Exactly like the following image. I have tried rnorm but it generates random numbers which do not necessarily increase, ...
2
votes
1answer
61 views

How to generate random variables which are correlated and yet marginally identically distributed? [closed]

I am wondering if there is a process to which we can generate random variables where there is a correlation structure between them, yet they are still marginally identically distributed? One idea that ...
1
vote
0answers
30 views

How to simulate random correlation matrix containing off diagonal structures

I want to simulate a correlation matrix which has some off-diagonal structures and also should have some hierarchical structures. For simulating correlation matrices which contain hierarchical ...
0
votes
0answers
35 views

Different training results on different machines?

I'm running the exact same script (Python, TF and Keras) on my Macbook and on a DGX Server. I've tried once to verify if I can get the exact same result on both machines by fixing every seed of ...
1
vote
0answers
71 views

Simulate correlation matrix using a given structure

I want to generate correlation matrix such that it follows the below structure $$\Sigma = B \Lambda B^T $$ where $\Lambda$ is a diagonal matrix containing positive elements, $\Sigma \in R^{n \times n}...
2
votes
1answer
36 views

Why random numbers from fitted distribution do not have the same distribution as the sample data?

I have a data set and I would like to fit a t distribution on it. I use R or Python to feed into my data, and I get the degrees of freedom, the location and the scale parameters. After that, I ...
2
votes
1answer
116 views

Correlated random variables from mixture distributions

Let I have three random variables whose density is a mixture of two Normals with these parameters: $\mu_{1,1}=6.8$, $\mu_{1,2}=6.95$, $\sigma_{1,1}=0.065$, $\sigma_{1,2}=0.055$ and $\alpha_{1}=0.4$ $\...
1
vote
0answers
28 views

Is there a known PRNG that passes TestU01's BigCrunch but fails any test in NIST 800-22?

In other words, does TestU01 incorporate all statistical tests by NIST 800-22?
1
vote
0answers
45 views

A question about ``frequency of p-values''

In NIST 800-22, a battery of tests for rejecting a random number generator, they present their results with 10 columns expressing the frequency of p-values (section 5.7, interpretation of results, ...