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

learn more… | top users | synonyms (2)

1
vote
0answers
13 views

Picking tuples from a list with low discrepancy

Given a list of m items, I am looking for a way to repeatedly pick a tuple of n distinct items from this list with low discrepancy. For example, suppose I have a list of 3d points, and I want to ...
-4
votes
1answer
43 views

randomly generate either -1 or 1 [closed]

How do I generate values either -1 or 1 in R ? sample(0:1,10,replace=T) produces random 10 samples of either 1 or 0. If I modify this code to ...
0
votes
0answers
37 views

Is it possible to use runif() to generate a vector of random variables with different probabilities? [duplicate]

Here's the question I have to solve: Let X be a random variable with pmf as given: P(X = 1) = 0,1 P(X = 2) = 0,3 P(X = 3) = 0,6. Simulate this distribution ...
6
votes
2answers
106 views

How to create an arbitrary covariance matrix

For example, in R, the MASS::mvrnorm() function is useful for generating data to demonstrate various things in statistics. It ...
0
votes
0answers
25 views

Generating sample numbers at a spesific distribution from uniform distribution [duplicate]

It's a known fact that we can generate sample numbers at random (Uniform distribution) from any probability distribution, given its cumulative distribution function. But if we want to generate sample ...
0
votes
2answers
38 views

Where in R code should I us set.seed() function (specifically, before shuffling or after) ?

I've been using the set.seed() function to reproduce same results on multiple runs. However, I don't understand where to use the function. the reason I'm asking this is because if I use the function ...
0
votes
0answers
34 views

How to generate new random variables after using PCA for dimension reduction?

I want to be able to generate random variables, that (more or less) match the distribution of some observed data set. The data set is high dimension and I have reduced the dimension using PCA. Only ...
0
votes
0answers
13 views

Generating correlated uniform random variables [duplicate]

How can I generate two Uniform $(0,1)$ variables $U, V$ with correlation approximately .25?
0
votes
0answers
34 views

transitive dice in pseudorandom number sequences

Background: Transitive several dice that act individually as if they are uniformly random but they are built to work against each other. If you know which one your opponent chose, there is a ...
0
votes
1answer
25 views

Transformation from skewed to symmetric distribution

Let us consider a positive valued random variable $X$ which is following a positively skewed probability distribution. Is it possible to a get a function $f$ (one-to-one) for which $f(X)$ follow a ...
1
vote
1answer
35 views

Do normal random number generators give a specified sample mean or population mean?

Do normal random number generators like R's rnorm give a specified sample mean or population mean? For example does the mean argument in R's ...
1
vote
1answer
16 views

generating random matrix

My problem is this: I have a matrix with three columns. I created a second matrix with only two columns where column1 is the first column (col1) from the first matrix and column2 = 0.01*col1*col2*col3....
0
votes
0answers
7 views

Using the composition algorithm to generate a standard normal variate

This is regarding a question from a past exam that I came across but it has no solution. Given that I can generate random variates from the absolute value of a standard normal variate $X$, with pdf $...
4
votes
1answer
46 views

Generating random samples from Huber density

Huber density, connected to Huber loss, can be defined as: $$ f(x) = \frac{1-\epsilon}{\sqrt{2\pi}} e^{-\rho_k(x)} $$ where $$ \rho_k(x) = \begin{cases} \frac{1}{2} x^2 & |x|\le k \\...
0
votes
0answers
13 views

Subset of Pareto/powerlaw distribution

Given a set of random data generated using pareto-distribution, how can I get X% of this random data without losing pareto-distribution. In other words, how to select a subset of pareto-distribution ...
3
votes
0answers
29 views

Generating valid random correlation matrices with non-negative entries

The title is pretty self-explanatory. I need to efficiently generate correlation matrices (i.e. semidefinite-positive, symmetric and all ones along the diagonal) of size $n$, with the limit that ...
0
votes
1answer
25 views

How to interpret Monte Carlo samples of the ratio of two variables?

My aim is to find the 95% confidence interval of the ratio of two variables for which I have summary statistics. More specifically, I have the prevalence of mothers drinking during their pregnancy (...
14
votes
1answer
994 views

If so many people use set.seed(123) doesn't that affect randomness of world's reporting?

It seems like everyone just uses set.seed(123) or set.seed(1234) when they are doing random sampling. If so many people use ...
0
votes
1answer
43 views

Bayesian inference for the rate parameter $\lambda$ of an exponential with Accept Reject

Let a prior distribution be $$ \pi(\lambda)=\begin{cases} \frac{2\lambda}{3} & 0 < \lambda \le 1 \\ \frac{2}{3\lambda^2} & \lambda > 1 \end{cases} $$ This ...
0
votes
2answers
36 views

Generating data from a Beta-Binomial distribution by inverting CDF in R [closed]

I am trying to generate data from a beta-binomial distribution by inverting its cdf in R. The code I have written to calculate the cdf seems to be working fine for most cases, but gives me values ...
1
vote
0answers
20 views

How is variance controlled in a matched random assignment?

Can someone explain to me why in a matched random assignment, the variance is also controlled in addition to the mean? And if it doesn't control for the variance, is there a random assignment strategy ...
1
vote
0answers
26 views

Which random number generator is used in scikit learn and in R?

I want to generate same random numbers as used in R in my RandomForestRegressor class in scikit learn Python library. So I want to know which random number generator is used in R, and how I can ...
3
votes
0answers
15 views

Best way to check implementation of density, distribution function and random generation

What is the best way to check if implementation of density, distribution function, quantile function and random generation for some distribution are correct? For example, base R lacks Laplace ...
0
votes
0answers
16 views

Randomly erase data given sparseness

I would like to sparsify a data frame given the sparseness value. That is, I would like to randomly delete some data from the dataframe to later use an imputation algorithm to impute the missing ...
3
votes
1answer
33 views

Random generation from multivariate hypergeometric distribution

James E. Gentle (2003) in Random Number Generation and Monte Carlo Methods describes the following algorithm for random generation from multivariate hypergeometric distribution: To generate a ...
0
votes
0answers
18 views

Testing Random Number Generators(RNG)

There are numerous tests of RNGs. Consider that we tested RNG with lots of different seeds and the output is as follows: with certain seeds the RNG passes the test, with other seeds RNG doesn't pass. ...
1
vote
0answers
85 views

Generating random numbers from the skew-t distribution, problem with density plots

in another question I was trying to replicate density plots using random numbers coming from the skew-t distribution of Hansen (1994). Now I need to obtain a series of random numbers coming from this ...
1
vote
0answers
45 views

lemma proof for alias method for generating discrete random variables

I'm looking to prove the lemma written in chapter 11, page 274 of Sheldon M. Ross's Simulation, regarding the alias method for random variable generation. As a prelude to presenting the method for ...
5
votes
0answers
132 views

What are real life examples of an exploited Random Number Generator

We all know that Random Number Generators in computers don't generate true random numbers, but instead generate pseudo-random numbers. Also, some RNGs are better than others, and some are ...
1
vote
1answer
41 views

Generation of Normal Distributed Numbers (with Box-Muller method?)

I want to generate several random, normal distributed numbers. At the moment I use the Box-Muller method. I have a function that returns a single number, and for this I use the following formula: ...
1
vote
1answer
104 views

Correlation between Normal variate generations

I have a function that returns normal distributed random numbers (let's call a single number X) when I pass the parameters mean ...
0
votes
0answers
16 views

Generating Skewed Z-Scores with Kurtosis

I am looking to programmatically generate random z-scores from a distribution with a specific skew and kurtosis. Can anyone provide a mathematical technique or code (VBA or C++ preferred but I'll take ...
5
votes
2answers
259 views

How to generate two groups of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal?

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 $U\sim U(0,1)$, make $s=\sum u_i$. Then I ...
0
votes
1answer
49 views

How to generate conditioned random variables from a density function?

I want to generate random variables from a distribution function using inverse sampling with the additional condition that the sampling should be conditioned, i.e., random generated variables should ...
0
votes
1answer
22 views

Constructing a random Experiment

Can someone help me as how to construct a random experiment which has the following density:$$\frac{1}{2\sqrt{2\pi}}\left(e^{\frac{-x^2}{2}}+e^{\frac{-(x-10)^2}{2}}\right)$$ Update: According to what ...
0
votes
1answer
50 views

Is my scatter chart random

I used =RAND()*500 in Excel and added to a scatter chart: How can I know if it is indeed Random?
0
votes
0answers
14 views

Generate random variables with predefined correlation structure AND fixing some values (followup)

This question is basically a followup to this one: Generate random variables with predefined correlation structure AND fixing some values because I can't follow the answer given there. I would like ...
3
votes
2answers
211 views

Generating samples from kernels other than Epanechnikov's

Generating samples from kernel densities with Gaussian kernel is very simple, the same with uniform, or triangular kernels. There is also a smart algorithm for generating samples from Epanchenikov ...
1
vote
2answers
77 views

How does Random Number Generation work?

I'm using the set.seed() function in R to achieve reproducability of my results. I compare different regression methods (e.g. RandomForest, SVM, GAM) by their MSE derived from a cross-validation ...
3
votes
3answers
66 views

Is it possible to generate data for stochastic process with specific distribution and autocorrelation?

It seems though that there is a disconnect between constructing paths of a stochastic process with both a specific distribution and autocorrelation. It seems like you can have either one property or ...
1
vote
1answer
59 views

Relationship between probability distribution and correlation [closed]

I'm unsure of the precise relationship between a probability distribution and correlation, in particular autocorrelation. What exactly is an autocorrelated probability distribution? It seems like ...
0
votes
1answer
34 views

Generating random variables with inverse df

Assume a distribution $X$, and we know the idf $F^{-1}$ of $X$. Let $U \sim U(0,1)$. Why is drawing an element from X according to $F^{-1}(u) = Z$ considered to be more random than just drawing an ...
1
vote
1answer
33 views

Some details about the Box-Muller transform method

I am confused about why $Z_0$ and $Z_1$ are independent. It seems like they both rely on $U_1$ and $U_2$. Could someone prove the statement?
3
votes
0answers
36 views

Generate multivariate time series

Suppose that I want to generate tri-variate Gaussian time series $\{(X_{1i}, X_{2i}, X_{3i}), i=1,2,...,n\}$ with a correlation structure across the three time series; that is, $(X_{1i}, X_{2i}, X_{3i}...
0
votes
1answer
25 views

Test for RVs with known probabilities?

I have written code that generates a sequence of distinct integers. The integers are assumed to occur in the sequence with fixed probabilities. For example, if the sequence contains the numbers [-1,0,...
0
votes
0answers
19 views

What are some randomness tests I can perform on a PRNG with arbitrary integral range?

I am working on developing a PRNG which transforms bits of source entropy into integers which are uniform over the range [1, N], where N is any integer greater than one. This is exactly what ...
0
votes
1answer
41 views

How to get Normal distibuted random numbers [closed]

I need to generate random numbers following Normal distribution. If X is a radius, and Y is an angle, how I can transform it into Descartes coordinates, and are they normally distributed?
0
votes
2answers
48 views

How can I output random points under a Laplacian density function in Matlab? [closed]

E.g. given a Standard Laplacian distribution: g = @(x) 1/(2*1)*exp(-(abs(x-0))/1); % Std Laplacian distribution How can I produce ...
1
vote
2answers
71 views

How do you sample data from a known distribution?

Lets say I have a known probability distribution. It could be power-law distribution or a Gaussian distribution for example. If I know the necessary parameters of the distribution, then how do I ...
1
vote
0answers
5 views

Generate sample process with CrossSectional Correlation and autoregressive structure

How can you generate a sample multidimensional time series $X_{t,i}$ for $t \in \{1,2,...,T\}$ and $i \in \{1,2,...,M\}$ where: $E[X_{t,i}] = 0$ $E[X_{t,i}X_{t,j}] = \Sigma_{i,j}$ $E[X_{t,i}|X_{t-1,...