Description Usage Arguments Details Value Note Author(s) References Examples
View source: R/correlatedsamplers.R
Allow user to draw from a uniform distribution correlated with a user specified vector
1 | runifcor.cor(x, rho)
|
x |
variable to draw from |
rho |
correlation coefficient between x and result of function |
Rough estimate
a vector of the same length as x drawn from a normal distribution correlated with x at the level of rho
runif only works coming from uniform data
Jared E. Knowles
modified from Eric Neuwirth http://r.789695.n4.nabble.com/Generating-uniformly-distributed-correlated-data-td3314905.html
1 2 3 4 5 | x <- runif(1000)
y <- runifcor.cor(x, 0.2)
cor(x,y) # very close to 0.2
mean(y)
sd(y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.