Learn R Programming

simer (version 1.0.0)

build.cov: Correlation building

Description

To bulid correlation of variables.

Usage

build.cov(df = NULL, mu = rep(0, nrow(Sigma)), Sigma = diag(2), tol = 1e-06)

Value

a data frame with expected correlation

Arguments

df

a data frame needing building correlation.

mu

means of the variables.

Sigma

covariance matrix of variables.

tol

tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma.

Author

Dong Yin and R

Details

Build date: Oct 10, 2019 Last update: Apr 28, 2022

References

B. D. Ripley (1987) Stochastic Simulation. Wiley. Page 98

Examples

Run this code
df <- data.frame(tr1 = rnorm(100), tr2 = rnorm(100))
df.cov <- build.cov(df)
var(df.cov)

Run the code above in your browser using DataLab