inst/book-ex/Rcode-6-1.R

set.seed(123456)
e <- rnorm(500)
## trend
trd <- 1:500
S <- c(rep(0, 249), rep(1, 251))
## random walk with drift
y1 <- 0.1*trd + cumsum(e)
## random walk with drift and shift
y2 <- 0.1*trd + 10*S + cumsum(e)

Try the urca package in your browser

Any scripts or data that you put into this service are public.

urca documentation built on Sept. 9, 2022, 3:06 p.m.