Learn R Programming

fastpos (version 0.4.1)

create_pop: Creates a population with a specified correlation.

Description

The correlation will be exactly the one specified. The used method is described here: https://stats.stackexchange.com/questions/15011/generate-a-random-variable-with-a-defined-correlation-to-an-existing-variables/15040#15040

Usage

create_pop(rho, size)

Value

Two-dimensional population matrix with a specific correlation.

Arguments

rho

Population correlation.

size

Population size.

Examples

Run this code
pop <- create_pop(0.5, 100000)
cor(pop)

Run the code above in your browser using DataLab