rnormcorV: Generate a vector from a normal distribution correlated with...

Description Usage Arguments Details Value Author(s) Examples

View source: R/correlatedsamplers.R

Description

Allow user to draw from a random normal distribution correlated with a user specified vector

Usage

1
rnormcorV(x, rho, ...)

Arguments

x

variable to draw from

rho

correlation coefficient between x and result of function

Details

Rough estimate, biased by known amount for now

Value

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

Author(s)

Jared E. Knowles

Examples

1
2
3
4
5
x <- rnorm(1000, 1, 1)
y <- rnormcorV(x, 0.2)
cor(x,y) # very close to 0.2
mean(y) # close to 0
sd(y)   # close to 1

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