Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Generate random values in R with a defined correlation in a defined range

l.michels:

For a science project, I am looking for a way to Generate Random data in a certain range (e.g. min=0, max=100000) with a certain correlation with another variable which already exists in R. The goal is to enrich the dataset a little so I can produce some more meaningful graphs (no worries, I am working with fictional data).

For example, I want to Generate Random Values correlating with r=-.78 with the following data:


var1

I already came across some pretty good solutions (i.e. http://ift.tt/2tDOgtt), but only get very small values, which I cannot transform so the make sense in the context of the other, original values.

Following the example:


var1 n rho theta x1 x2 X Xctr
Id Q P x2o Xc2 Y var2 cor(var1, var2)

What I get for var2 are values ranging between -0.5 and 0.5. with a mean of 0. I would like to have much more distributed data, so I could simply transform it by adding 50 and have a quite simililar range compared to my first variable.

Does anyone of you know a way to Generate this kind of - more or less -meaningful data?

Thanks a lot in advance!



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Generate random values in R with a defined correlation in a defined range

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×