colored_multi_rnorm | R Documentation |

Generates random variables that are correlated to each other and temporally autocorrelated.

```
colored_multi_rnorm(timesteps, mean, sd, phi, covMatrix)
```

`timesteps` |
The number of temporally autocorrelated random numbers (one per timestep) you want. |

`mean` |
A vector giving the mean of each variable. |

`sd` |
A vector giving the standard deviation of each variable. |

`phi` |
A vector giving the temporal autocorrelation of each variable. |

`covMatrix` |
A valid covariance matrix. The number of rows/columns must match the length of the mu, sigma, and phi vectors. |

A matrix with as many rows as timesteps and as many columns as mu/sigma/phi values.

```
cov <- matrix(c(1, 0.53, 0.73, 0.53, 1, 0.44, 0.73, 0.44, 1), nrow = 3)
test <- colored_multi_rnorm(100, c(0, 3, 5), c(1, 0.5, 1), c(0.5, -0.3, 0), cov)
var(test)
library(data.table)
as.data.table(test)[, .(V1_mean = mean(V1), V2_mean = mean(V2), V3_mean = mean(V3),
V1_sd = sd(V1), V2_sd = sd(V2), V3_sd = sd(V3),
V1_autocorrelation = autocorrelation(V1), V2_autocorrelation = autocorrelation(V2),
V3_autocorrelation = autocorrelation(V3))]
```

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.