Description Usage Arguments Details Value Author(s) Examples

The function simulates a pair of correlated variables.

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

`n` |
integer: sample size. |

`r` |
numeric: correlation. |

`plot` |
logical: generate scatter plot of the variables. |

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.

data.frame with entries `Var1`

and `Var2`

Matthias Kohl [email protected]

1 2 | ```
res <- simCorVars(n = 100, r = 0.8)
cor(res$Var1, res$Var2)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.