simcor {correlatio}R Documentation

Simulate two correlated variables.

Description

Simulate pairs of variables with a predefined correlation between them.

Usage

simcor(obs = 100, rhos = c(-0.5, 0.5))

Arguments

obs

A single integer that determines the number of simulated observations in each of the pair of variables.

rhos

A vector with at least one value that shows the theoretical correlation between the simulated pair of variables.

Value

a list with as many data.frames (each consisting of two columns) as there are values passed to the function argument 'rhos'.

Author(s)

Marcel Miché

References

pdf, see headline: Simulating data with known correlations

Examples

# Simulate a list with two data.frames. The first one contains variables that are correlated
# around -.8, the second one around .7. Both data.frames contain 200 observations.
simcor(obs = 200, rhos = c(-.8, .7))

[Package correlatio version 0.2.1 Index]