corgen {ecodist}R Documentation

Generate correlated data

Description

Generate correlated data vectors of a given length.

Usage

corgen(len, r, population = FALSE, epsilon = 0)

Arguments

len Length of data vectors.
r Correlation between data vectors.
population TRUE for vectors drawn from two populations with correlation r, otherwise r is the sample correlation.
epsilon If epsilon = 0, it has no effect, otherwise the sampling process is repeated until the sample correlation is within epsilon of r. This option allows the production of exactly-correlated data, within the limits of epsilon.

Details

This function is more sophisticated that the corgen function available in the stats package.

Value

If it is a LIST, use

x First data vector.
y Second data vector.

...

Author(s)

Sarah Goslee

See Also

~~objects to See Also as help, ~~~

Examples


# create two random variables of length 100 with correlation 
# of 0.10 +/- 0.00001
corgen(100, .1, epsilon=0.00001)


[Package ecodist version 1.1.2 Index]