create_pop: Creates a population with a specified correlation.

View source: R/fastpos.R

create_popR Documentation

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)

Arguments

rho

Population correlation.

size

Population size.

Value

Two-dimensional population matrix with a specific correlation.

Examples

pop <- create_pop(rho = 0.5, size = 1e6)
cor(pop)

fastpos documentation built on Aug. 16, 2022, 1:06 a.m.