Description Usage Arguments Examples
Generates time series from an AR1 model.
1 |
n |
number of values |
alpha |
lag-1 autocorrelation |
mean |
mean |
sd |
standard deviation |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(CoSMoS)
## generate 500 values from an AR1 having lag-1 autocorrelation 0.8,
## mean value equal to 0, and standard deviation equal to 1.
n <- 500
## generate white noise for comparsion
x <- rnorm(n)
ggplot() +
geom_line(aes(x = 1:n,
y = x)) +
labs(x = '',
y = 'value') +
theme_classic()
## generete values using AR1
y <- AR1(n, .8)
ggplot() +
geom_line(aes(x = 1:n,
y = y)) +
labs(x = '',
y = 'value') +
theme_classic()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.