Linked Questions
43 questions linked to/from Generate a random variable with a defined correlation to an existing variable(s)
33
votes
1
answer
34k
views
Generate two variables with precise pre-specified correlation [duplicate]
UPDATE: Solution
Thanks to Greg Snow for pointing out the empirical = TRUE command in mvrnorm (multivariate random normal stuff)! Here's the explicit code:
...
2
votes
1
answer
1k
views
How can I generate 2 sets of variables from different distributions with a correlation between them in r? [duplicate]
I am working in R and would like to generate 40 numbers from $\mathrm{N}(0,1)$ and another 40 from $\mathrm{Uniform}(0,2)$ with a negative correlation (for example: $r = -0.45$) between them. The ...
0
votes
1
answer
450
views
I like to generate correlated variables with a existing variable in R [duplicate]
In R, I like to create a set of variables that are correlated with a given variable.I scanned related questions but failed to find the same issue i have.
Here is instance.
...
1
vote
1
answer
402
views
Generate vectors with specified sample correlations with a fixed vector [duplicate]
I have a vector $Y$ of size less than 75. I want to generate vectors $X_1$ and $X_2$, of the same size, satisfying the following constraints.
Sample mean and variance of $X_1$ and $X_2$ are equal to ...
0
votes
0
answers
98
views
How to generate and correlate more than two random variables which are from different non-parametric distributions given then correlation matrix? [duplicate]
I tried to fit three variables using the non-parametric method(kernel smooth), and those distribution for each of three variables are different, so cholesky descomposition won´t work for replicate the ...
1
vote
1
answer
87
views
Create a data set with correlated variables [duplicate]
I am trying to create a dataset where columns 2,3,4 are correlate (0.98,0.97,0.96, respectively) to column 1. Right now I have this code:
...
2
votes
1
answer
34
views
Generate x and y with controlled correlation [duplicate]
I want to generate x and y variables with a controlled correlation. Currently, I'm using the following code to generate x and y (below). However, I want create a function where I can specify the ...
0
votes
0
answers
22
views
Use Monte Carlo to produce new 'p' correlated data from existing data [duplicate]
As mentioned above, I have a problem where I need to generate new data Y from an existing data X such that Y is p correlated to X.
I know their are several ways to do it but I want to know if monte ...
62
votes
4
answers
68k
views
How to generate correlated random numbers (given means, variances and degree of correlation)?
I'm sorry if this seems a bit too basic, but I guess I'm just looking to confirm understanding here. I get the sense I'd have to do this in two steps, and I've started trying to grok correlation ...
17
votes
4
answers
16k
views
Are two standard normal random variables always independent?
I learned that the standard normal distribution is unique because the mean and variance are fixed at 0 and 1 respectively. By this fact, I wonder if any two standard random variables must be ...
37
votes
3
answers
38k
views
Generating data with a given sample covariance matrix
Given a covariance matrix $\boldsymbol \Sigma_s$, how to generate data such that it would have the sample covariance matrix $\hat{\boldsymbol \Sigma} = \boldsymbol \Sigma_s$?
More generally: we are ...
27
votes
3
answers
28k
views
How can I generate data with a prespecified correlation matrix?
I’m trying to generate correlated random sequence with mean = $0$, variance = $1$, correlation coefficient = $0.8$. In the code below, I use s1 & ...
14
votes
1
answer
5k
views
How to define a distribution such that draws from it correlate with a draw from another pre-specified distribution?
How do I define the distribution of a random variable $Y$ such that a draw from $Y$ has correlation $\rho$ with $x_1$, where $x_1$ is a single draw from a distribution with cumulative distribution ...
16
votes
1
answer
2k
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 ...
6
votes
3
answers
13k
views
Tool for generating correlated data sets
Does anyone know of a tool that I can use to generate a set of data with known correlations (and to put the icing on the cake - output this in json,csv,txt or some common format)?
I am working on ...