Linked Questions

15
votes
1answer
15k views

Generate two variables with precise pre-specified correlation [duplicate]

I want to generate two variables with (pseudo-) random numbers with an exact pearson's r. How do I do that? Python and/or R solutions would be nice! I am able to generate random data that ...
0
votes
1answer
91 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. ...
2
votes
1answer
44 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
0answers
27 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 ...
53
votes
4answers
45k 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 ...
16
votes
4answers
6k 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 ...
19
votes
3answers
19k 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 & ...
10
votes
1answer
3k 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 ...
7
votes
4answers
2k views

Generate sets of values with high correlation coefficient

Apology if this is too simple. I couldn't get the more advanced r-help group to respond. I am planning to characterize workloads by measuring the correlation coefficient of two sets of real values ...
5
votes
3answers
5k 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 ...
6
votes
2answers
3k views

Maximising the correlation between vectors vs minimising the angle between them

In this talk http://videolectures.net/lms08_hardoon_scca/ (4:58) David says that maximizing the correlation between vectors can be viewed as minimizing the angle between them, and gives two references:...
5
votes
1answer
345 views

Generate random variables with predefined correlation structure AND fixing some values

I need to generate 4 random variables that show a predefined correlation structure Sigma AND where certain values of Vars 1-4 are fixed. As an illustrative example, consider the variables: ...
1
vote
1answer
668 views

Creating two random sequences with $50\%$ correlation?

How can I create two random sequences of numbers that are $50\%$ correlated to each other? Each sequence has a different variance.
0
votes
1answer
1k views

Generate three pairwise correlated random variables

I need to simulate three variables $A,B,P$ ~ $N(0,1)$ such that the Pearson correlations $r_{AB}=\operatorname{cor} (A,B)$ and $r_{BP}=\operatorname{cor}(B,P)$ are given. I need to repeat the ...
4
votes
1answer
525 views

Generate a random variable with a defined correlation to multiple existing variables

this question is strongly related to: Generate a random variable with a defined correlation to an existing variable. However I'm struggling to implement it in a more complex matter: Given X, a ...

15 30 50 per page