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.
794 questions
0
votes
0
answers
32
views
Generated correlation random numbers with arbitrary, non-identically distriubuted distributions
I have a dataset from which I need to construct priors from which to draw vectors of correlated but non-identically distributed random samples. For the sake of example, suppose I have $n$ lognormal ...
0
votes
0
answers
56
views
Generating correlated random numbers with non-identically-distributed random variables
I have a semi-Markov process in which the time between states is log-normally distributed, but with parameters that depend on $n$ (the mean and variance are state-dependent). In other words I have the ...
2
votes
0
answers
57
views
A method of generating smooth random cylindrical shells
I am a graduate student in aerospace engineering currently working on the nonlinear buckling analysis of cylindrical shells with random geometric imperfections.
Perfect cylindrical shell.
The ...
4
votes
1
answer
151
views
How to generate random categorical data when number of categories is very large?
Problem in brief
I would like to generate several samples of iid categorical data. The standard approach does not work because the potential number of categories is large, and I do not want to impose ...
1
vote
1
answer
101
views
Generating samples from a symbolic distribution
The following considers the fundamental statistics underlying this computational question.
One can compute a random variate from a numerically defined statistical distribution. Thus we can ask for ...
5
votes
2
answers
932
views
Why is "white noise" generated from uniform distribution sometimes autocorrelated?
I am trying to understand properties of different time series models. In order to be a white noise $w_t$ must follow three conditions:
$E(w_t) = 0$,
$Var(w_t) = \sigma^2$, and
$cov(w_t, w_s) = 0$, ...
0
votes
0
answers
52
views
5
votes
1
answer
268
views
Is repeating a test on fresh data until a statistically significant result is reached p-hacking? [duplicate]
I have a quantum random number generator and I wish to know if it can pass a set of statistical tests to check whether it’s truly random.
For this I use the Dieharder suite of tests.
In this suite, ...
3
votes
2
answers
615
views
Inverse Gaussian with small mean has unreliable sample mean
Consider an inverse Gaussian with a small mean $\mu$ (such as $0.001$) and such that we fix its variance to a larger value $\sigma^2$, say $0.5$. Then if I sample $N$ times from this distribution, I ...
2
votes
1
answer
155
views
Generate Quasi Random Numbers for a Multivariate DIstribution
Algorithms like Sobol or Holton provide quasi random numbers (that is, the numbers "look" random in the sense of a uniform distribution, but they are deterministic) in the hypercube $[0,1]^d$...
1
vote
1
answer
129
views
Generating pseudo-random sample sequence with a given autocorrelation function up to max lag
Assume the variable $X_t$ has a continuous value, sampled over uniform discrete time (time series).
I have the full autocorrelation function up to max time lag $l_{max}$. The coefficients may be both ...
4
votes
5
answers
548
views
Generating a normally distributed variable using a known range, but an unknown mean, in R [closed]
I would like to generate a normally distributed variable of 100 data points with a known range (e.g. $10.4\text{–}16.6$) but without a known mean. To use rnorm I need mean and sd. I could estimate a ...
3
votes
0
answers
121
views
Generating Samples from the Unnormalized Gamma Conjugate Prior
Wikipedia lists the following as an unnormalized conjugate prior of the gamma distribution in the case where both parameters $\alpha,\beta$ are unknown:
$$
\frac{p^{\alpha-1} e^{-\beta q}}{\Gamma(\...
10
votes
1
answer
1k
views
Would it be possible to generate data from real data in medical research? [closed]
We are trying to develop some predictive models in medical research. We have combination of clinical and RNA-seq data just for 40 patients. The problem is classification. After feature selection, we ...
1
vote
1
answer
98
views
Generating highly non-independent random samples
I'm testing performance of statistical tests in the face of non-independent data and I'd like to generate random data where I know the underlying statistical distribution.
The easiest way to do it is ...
1
vote
1
answer
97
views
Quasi-random number sequence that is unbiased on the unit interval
I am trying to use the Halton sequence for a quasi-Monte Carlo method in two dimensions. However, a problem I am running into is that the mean of the sequence is always less than one-half (except for ...
1
vote
0
answers
58
views
Choosing a unique visitor on the fly
I've been thinking of this as the "Prize of the Week" problem. Suppose you run a shop, and want to give out a prize once a week to someone making a randomly-selected purchase. You give out ...
0
votes
0
answers
28
views
Does pattern in random seed for Pseudo random functions cause bias [duplicate]
I am using random forest in R, and for different test sets I'm using patterned seeds in the sample function. For one test set I use 1234, for the next 2345, the next 3456. I suspect it is unlikely, ...
1
vote
0
answers
27
views
How to accurately determine if a random method is indeed random? [duplicate]
I wanted to do a project where I measured how random the native RNGs are in various programming languages. How can I objectively measure my results? Also, if you run a random number generate say 100 ...
1
vote
0
answers
147
views
Tightness of rejection sampling
Hello. I'm studying the Monte Carlo Statistical Method textbook by Robert and Casella. I have a question about exercise problem 30 in Chapter 2. I've already solved parts (a)-(c), but I'm having ...
-1
votes
1
answer
71
views
Generating Distributions From Random Number Generators
Background
I am working on developing a R package that focuses on implementation of pseudo-Random Number Generators (pRNGs) from scratch. To date I have successfully programmed a Linear Congruential ...
2
votes
0
answers
89
views
How to shuffle and deal with constraints?
I'm playing a 4-player game of cards. My opponents are called A, B and C. At the beginning of the game, each player has been dealt a hand of cards out of a deck containing 4 suits of cards: Black, Red,...
0
votes
1
answer
148
views
Drawing randomly from range - is a uniform distribution possible?
The specific task is to draw 5 random samples in the range of 0 to 90 with a minimum disstance of 7 between each sample.
I performed 1 million runs with respect to the conditions. The first image ...
0
votes
0
answers
34
views
Determining Optimal Output Length for Algorithmic Pseudo-Randomness with Unique Mapping for Inputs of Size X
I am constructing an algorithm where it should map every input to a different output and the output bits should be statistically random (that is when put into randomness test suites (like NIST), it ...
4
votes
2
answers
342
views
Am I right that the Bonferroni correction does NOT apply to randomness testing?
There are statistical test suites (below) that are commonly used to determine whether a sequence appears to be (pseudo) random. Some of these test suites have a few tests (ent/ent3000), whilst others ...
5
votes
3
answers
1k
views
Generate multivariate distributions of lognormal and normal distribution in python
I need to generate random numbers from 3 correlated distributions. First two of them are lognormal and the final one is normal, i.e. for X, ...
1
vote
0
answers
58
views
Can inverse sampling method be adapted to random vectors?
This might be a very basic question, but it seems that in all the examples I've seen, the inverse sampling method (i.e., input uniform RV into the inverse of CDF of desired PDF/probability ...
1
vote
0
answers
82
views
Unbiased estimate of mean test score of pupils in a country (sampling frame of schools is avaible only)
My primary goal is to get unbiased estimate of mean test score of every pupil in a country. I have no sampling frame of all pupils to randomly sample from. But I have a sampling frame for every school....
1
vote
1
answer
129
views
Does an algorithm exist that generate copula when marginal distributions are available and stable distributed and correlation is not simple?
I have simulated data of a 4-dimensional random variable $(X_1,X_2,X_3,X_4)$. The individual pdfs of these random variables, i.e., $X_i$ where $i\in\{1,2,3,4\}$ turns out to be stable distributed with ...
3
votes
0
answers
221
views
Uniformly sampling surface of an ellipsoid using multivariate Gaussian
Sampling uniformly from the surface of an ellipsoid (in the sense of $\mu(dA) = \frac{1}{A}$) seems very nontrivial:
How to sample uniformly from the surface of a hyper-ellipsoid (constant ...
0
votes
1
answer
155
views
Generating a random number with CDF $P(X \leq c) = 1-1/c$ in the interval $(1, + \infty)$. using uniform distribution
I have a uniform number generator in ($0, 1).$ I want to generate a random number with CDF $P(X \leq c) = 1-1/c$ in the interval $(1, + \infty)$. I know I should apply the inverse of my function to ...
2
votes
1
answer
287
views
Is there a law or theorem related to occurrence of an event with highest probability in a population with infinite size?
Assume, we have a key that appears in either of the three rooms randomly (red room, blue room, and green room). We have the following probability distribution:
...
0
votes
1
answer
134
views
Random Walk and Moving Average for Stock Market Model
I model a stock price with a completely random walk:
In each step I multiply the price with normal distributed random number with an mean of 1.
Then I compute a signal, which is True if the moving ...
0
votes
1
answer
185
views
Question about the inversion method for simulation of random variables [closed]
In the method called inversion we have :
Let $U$ ~ unif(0,1) denote a uniform random variable on $(0,1)$.
Then : $\mathbb{P}(F^{-1}(U))$ = $\mathbb{P}(U \leq F(x))=F(x)$
so $F^{-1}(U)$ has ...
0
votes
0
answers
36
views
How does one sample from a gaussian distribution without a library? [duplicate]
I am looking to write a program that generates samples from a gaussian distribution with a certain mean and standard deviation. I am not allowed to use any library except a random number generator. Is ...
2
votes
1
answer
112
views
Bootstrapping CI around variance ratio from random regression model
I am interested in the ratio of random slope variance from a random slope and intercept model. I fit the model using lme4 as
...
1
vote
0
answers
43
views
Generate numbers between 0 and N in a random order guaranteeing uniqueness with efficient memory cost [closed]
I'm trying to think of a method i could use to generate the random numbers between 0 and N in a random order and with uniqueness that would use the smallest footprint of memory at the beginning and ...
23
votes
2
answers
4k
views
How many numbers can I generate and be 90% sure that there are no duplicates?
Suppose I am generating random 4-digit numbers. Obviously there are 10,000 possible numbers, but the chances are I will get a duplicate long before I generate that many.
Can anyone explain how I would ...
3
votes
1
answer
3k
views
Sampling from Gaussian Process
I am learning the Gaussian process and feel confused about how three lines were generated in Fig 2.2(A) in the book "Gaussian Process For Machine Learning". As described by the author: "...
1
vote
1
answer
129
views
Drawing numbers using the CDF
Say I have a (generally high-dimensional) random variable $X$ with known, continuous CDF $F(X)$.
Is there a good algorithm for drawing values of $X$ that doesn't require that I calculate the joint ...
2
votes
0
answers
67
views
Drawing random numbers with quadrature
In a comment on this question, the user 'probabilityislogic' says "No, not MCMC this thing! Quadrature this thing! only 2 parameters - quadrature is the "gold standard" for small ...
3
votes
0
answers
187
views
Generating uniformly distributed particles on a $n$-dimensional flat torus or periodic hypercube [closed]
I am trying to generate evenly distributed particles in an $n$-dimensional flat torus or a periodic hypercube.
I am not sure if any of this approaches suffices. Can you suggest alternative methods for ...
12
votes
6
answers
2k
views
How to generate from this distribution without inverse in R/Python?
I am working with a distribution with the following density: $$f(x) = - \frac{(\alpha+1)^2 x^\alpha \log(\beta x)}{1-(\alpha + 1)\log(\beta)}$$ and CDF $$\mathbb{P} (X \leq x) = \int_0^x - \frac{(\...
2
votes
1
answer
238
views
Testing relationship between exponential and beta distributions using R
If X ~ Exp(3), Y ~ Exp(1) and h = X / (X + Y) then h ~ beta(1/3, 1) and E(h) = 1/4.
But when I draw random deviates using the following R code, I find mean(h) ≈ 0.324 and the histogram doesn't ...
2
votes
1
answer
96
views
Sampling from a distribution function $g_{x}$ that will follow $f_{x}$
I am using acceptance-rejection sampling to sample random variable $x$ according to distribution $f(x)$. The steps I followed are
First generated uniformly distributed random variable $x$ from 0 to $...
5
votes
2
answers
626
views
How to generate a standard normal distributed time-series with a given ACF
I want to generate a standard normal distributed time-series. In addition the ACF of my timeseries should match a desired ACF. I have given lags 1 to 30 with the corresponding ACF-values. For further ...
2
votes
0
answers
58
views
Relaxed magic-square generator distribution
This question is about a magic square generator, "relaxed" because
it's only about one vector (row) in the square independent of all other rows;
the individual elements are continuous and ...
8
votes
2
answers
461
views
Generating uniformly distributed random solutions of a linear equation
Given $n+1$ variables $p_0, p_1, \ldots, p_n$ defined over $\mathbb{R}^{+}$ so that $\sum_{i=0}^np_i=1$, and given a real number $1<x<n$, I want to generate random solutions of the equation so ...
12
votes
8
answers
2k
views
How to generate uniform distributed samples with given auto-correlation function
As I mentioned in the question title, I want to generate specific uniformly distributed samples.
I need them to model a real world scenario. For my real data, I estimated a function, which ...
0
votes
1
answer
91
views
Control Chart: Nelson alternating rule
The Nelson rules for control charts describe patterns, which are "special" and need our attention. One of these rules is the "alternation rule". According to Nelson it is "...