# 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.

627 questions
Filter by
Sorted by
Tagged with
19 views

### Given a mean, generate data using a distribution [closed]

Each week 20 cancer patients walk into a hospital, the average patient has 5 metastasis lesion. which distribution would I use to generate pseudo-data in MATLAB?
62 views

### Is there a continuous function that accepts a single uniform random variable and returns two independent uniform random variables?

I can define a function $f(X) = (Y_1,Y_2)$ that accepts a random variable $X$ with a uniform distribution on $[0,1]$, and returns two independent uniform random variables $Y_1,Y_2$. This function ...
55 views

### Seeking an intuitive understanding of independence for random variables

I'm trying to gain a deeper, more intuitive understanding of what it means for two random variables $X$ and $Y$ to be independent. From my statistics courses, I know that $X$ and $Y$ are independent ...
25 views

### How can I generate a dataset to test variable importance calculations?

I would like to generate random data that has predetermined variable importance, so that I can test out different methods of calculating variable importance and see how they perform vs. the ...
324 views

### @whuber 's generation of a random variable with fixed covariance structure

The question refers to @whuber's algorithm to draw a random variable with a given covariance structure to a given set of random variables: https://stats.stackexchange.com/a/313138/3277 The algorithm ...
3k views

### How to generate random integers between 1 and 4 that have a specific mean?

I need to generate 100 random integers in R, where each integer is between 1 and 4 (hence 1,2,3,4) and the mean is equal to a specific value. If I draw random ...
55 views

### Generating pairs of random variables with given covariance and gamma marginals

I have shape parameters $k_X, k_Y$ and scale parameters $\theta_X, \theta_Y$, as well as a covariance $\sigma_{XY}$. How do I generate random variables $(X,Y)$ such that the marginals are gamma ...
11 views

### How to estimate population size from repetition in random sampling? [duplicate]

I'm periodically sampling values from what's likely a large population. Millions, let's say. And I'm assuming initially that it's random sampling. However, it's only workable to collect thousands of ...
27 views

### How generate random data that satisfy specific constraints such as having specific median? in R [closed]

In general, how can I simulate data that exactly satisfies a set of constraints? I'm in need of generating a set of random numbers, which conform to a given median (not mean), and also fall within ...
79 views

### Is there a way to visualize the limited randomness of an algorithm?

Take the R runif function for example. It sure is a very performing pseudo-random generator. Even if I don't really know what it means I think I read somewhere ...
66 views

### How to generate a vector that has zero correlation with another vector (in R)?

Suppose I have a vector v1 with values in the set {-1,0,1} ...
20 views

56 views

### How to generate artificial data to have a similar results after doing an OLS estimation?

I am trying to replicate a paper that the data are confidential, however, for the sake of practice in coding and performing similar analysis, I am trying to generate artificial data so that after I ...
82 views

### Generating skew-normal distribution in Matlab

My apologies if this is a trivial question, but I am having trouble with this for a while now. I need to use a skew-normal distribution in research in MATLAB and the only way I found after googling ...
192 views

### Why is pseudo-random sampling applicable for Monte Carlo integration, even though it does not satisfy the CLT requirements?

Assume we have a function $f\left(x\right)$ defined on $\left[0, 1\right]$ that we want to integrate and estimate the error using Monte Carlo method. We generate realizations of uniformly distributed ...
21 views

### Setting seeds despite repeated training of CNNs?

I would like to compare the classification performance (like accuracy, precision, recall etc.) of different CNN architectures. I'm using Google Colab (GPU support), Tensorflow and Keras. Since it is ...
132 views

### which is the meaning of scatterplot between a pair of 2 consecutive pseudo random numbers with respect to the independence of the sequence?

Pseudo random number generators should give as output random sequences u1, u2, ... that are mutually independent and identically distribuited (iid). Since testing for independence is not easy, the ...
35 views

### check for noncorrelation of normal pseudo random numbers using scatterplot

pseudo random number generators should give as output random sequences u1, u2, ... that are independent and identically distribuited (iid). Since testing for independence is not easy, the first check ...
25 views

### Why is the exprected value of a sum of RV following a Z-distribution not equalt to 0?

I am using R to draw a thousand of RVs from a Z-distribution. I noticed that the expected value of their mean is as expected ~0 (magnitude 10^(-4)) sometimes positive, sometimes negative but; the sum ...
129 views

### Why is weighing random observations according to their probability from all distributions wrong?

Is sampling all distributions n times and then talking out i numbers from each sample, where i is probability of that distribution * n, wrong? Suppose  0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\...
39 views

### How to generate random samples from a 2D dataset?

Suppose I'm given a data set consisting of many pairs of $(x,y)$ values which are correlated in some arbitrary complex way. How would I go about 'generating' more pairs of $(x,y)$ coordinates which ...
14 views

### Simulate Data for Power of Random Intercepts Model

I am interested in calculating the power of a cluster randomized clinical trial of a binary intervention ($T$=1 for treated and $T$=0 for control). I have a pretty set number of candidate clusters ...
88 views

### How to generate a uniform random variable from [1,7] if given a uniform[1,5] RV generator? [duplicate]

I saw this as a question on glassdoor and I've seen similar questions elsewhere. Can someone explain the intuition of how to solve a problem like this? There are two scenarios The uniform RVs in ...
71 views

### Is there a way to generate artificial data from clusters?

Suppose you have a data set that can be clustered as follows: Is there a way to generate data that would fit inside, say, the red bubble, or blue bubble? This can definitely be done in two-dimensions,...
18 views

### Simulate cell missingness for a certain proportion of cells in a full data set

I know there was a question asked a few years back about simulating missingness. The original thread link is here How to simulate the different types of missing data Since then, there has been a ...
13 views

### Correct method for error propagation in pseudo-data approach (simulation) using model

I want to compute the error on the integral over experimental data $(y_i,\delta y_i)$ in a pseudo-data approach using model ($x_i$ are assumed to be known error-less numbers). If I were using direct ...
18 views

### how to do re-randomization test for trials used adaptive minimization with unequal allocation?

Re-randomization test is often chosen to validate the results from a study was randomized by adaptive minimization. In the case of of unequal allocation (like 2:1), it is more complicated because the ...
37 views

### What is the name of this simple discrete sampling algorithm?

I have a vector of probabilities $p \in \mathbb{R}^n$ which I have never seen before. I would like a single sample from the indices $(1, 2, \ldots n)$ according to the distribution defined by $p$. ...
39 views

### Generating random values from a multivariate skew-normal with fixed marginals

I'm generating random values from the multivariate skew-normal, and I want that the marginal distributions from this multivariate one have fixed parameters as the following: I'm generating from ...
70 views

### how to generate random data based on simple statistical meassures

0 I currently have a test data set that has 500k data points. I have an algorithm that process that data and returns some information. In order to establish the statistical significance of the ...
14 views

### Random variates generation for disrecte distribution by inverse transform method [duplicate]

I have solved this question but still confused. I don't know whether this method is correct or not and also the answer which I get is right or wrong, as I was told to generate random variates for ...
32 views

### Does rowwise distribution of random values in creating a normally distributed vector variable in matrix(rnorm(.), byrow=TRUE) damage normality?

(Reprodicible example added) 150-character-limitless full question is: Does the rowwise distribution of values in creating a normally distributed vector variable via ...
373 views

### Gamma Distribution for generating random numbers

I defined a gamma distribution with following parameters: shape,scale = 4.2503, 7037. This dribuation is used to generate random numbers. The random numbers will be recalculated to the x-asix value. ...
68 views

### How to use poisson to estimate arrival time (generate random integers)?

In my assignment, I'm supposed to use a distribution curve to describe how many minutes will the employee come to work in advanced or later than the planed start time. I decided to use Poisson ...
36 views

### Generating new(fake) probability distributions based on many sample probabilty distributions

I wish to be able to generate new probability distributions that incorporate the characteristics of many sample distributions available to me. I currently have data for the individual daily return ...
29 views

### How to Incorporate Skew Into Simulated Data?

Suppose I have a dataset $\mathbf{X}$ which is a $n \times m$ matrix of $n$ independent realizations of some $m$-dimensional random vector $\mathbf{x}$. I want to generate a new dataset $\mathbf{X}'$ ...
82 views

### Transforming a uniform random variate to points on a circle

Sample $U \sim \text{Uniform}(0,\sqrt{2}-1)$. Accept $U$ with probability $1/(1+U^2)$ (else reject and sample again). Set $X = 2U/(1+U^2)$ and $Y = 1-UX = (1-U^2)/(1+U^2)$. With probability 1/2, ...
73 views

### Randomization in an RCT: How harmful is it to try different RNG seeds?

Background I was asked to perform the randomization for a small study with 3 conditions $A$, $B$ and $C$. The three conditions are three different smartphone types. The participants enter the study ...
19 views

### Is this scaling algorithm viable?

I just came up with my own random number scaling algorithm (and I'm sure someone else has come up with it before me), and I wanted to see if any of you can find holes in it. The idea is to take a ...
35 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" ...
63 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 ...
12 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 ...
26 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. ...