# simCorVars

From MKdescr v0.4
by Matthias Kohl

##### Simulate correlated variables.

The function simulates a pair of correlated variables.

- Keywords
- univar

##### Usage

`simCorVars(n, r, plot = TRUE)`

##### Arguments

- n
integer: sample size.

- r
numeric: correlation.

- plot
logical: generate scatter plot of the variables.

##### Details

The function is mainly for teaching purposes and simulates `n`

observations
from a pair of normal distributed variables with correlation `r`

.

By specifying `plot = TRUE`

a scatter plot of the data is generated.

##### Value

data.frame with entries `Var1`

and `Var2`

##### Examples

```
# NOT RUN {
res <- simCorVars(n = 100, r = 0.8)
cor(res$Var1, res$Var2)
# }
```

*Documentation reproduced from package MKdescr, version 0.4, License: LGPL-3*

### Community examples

Looks like there are no examples yet.