runifcor.cor: Generate a vector from a uniform distribution correlated with...

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/correlatedsamplers.R

Description

Allow user to draw from a uniform distribution correlated with a user specified vector

Usage

1
runifcor.cor(x, rho)

Arguments

x

variable to draw from

rho

correlation coefficient between x and result of function

Details

Rough estimate

Value

a vector of the same length as x drawn from a normal distribution correlated with x at the level of rho

Note

runif only works coming from uniform data

Author(s)

Jared E. Knowles

References

modified from Eric Neuwirth http://r.789695.n4.nabble.com/Generating-uniformly-distributed-correlated-data-td3314905.html

Examples

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)   

jknowles/datasynthR documentation built on May 19, 2019, 11:42 a.m.