# NOT RUN {
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()
# }
Run the code above in your browser using DataLab