library(fable)
library(ggplot2)

White Noise

err<-rnorm(n=200,mean=0,sd=1)
wn<-data.frame(t = 0:199,y = err) %>% as_tsibble(index=t)
wn %>% autoplot() + ggtitle("White Noise TS")

TS with a stationary trend

x <- 0:199
err<-rnorm(n=200,mean=0,sd=1)
y<-10+0.03*x+err
trend.var<-data.frame(t=x,y) %>% as_tsibble(index=t)
trend.var %>% autoplot() + ggtitle("TS with stationary trend")

Random Walk

x <- 0:199
err<-rnorm(n=200,mean=0,sd=1)
f<-c()
f[1]<-err[1]
for (i in 2:length(x)){
  #print(i)
  f[i]<-f[i-1]+err[i]
} 

rw<-data.frame(t=x,y=f) %>% as_tsibble(index=t)
rw %>% autoplot() + ggtitle("Random Walk TS")

TS plots can also be simulated using the arima.sim library

wn_sim<-arima.sim(model = list(order=c(0,0,0)),n = 200)
wn_sim %>% plot(main="Simulated White Noise") 

rw_sim<-arima.sim(model = list(order=c(0,1,0)),n = 200)
rw_sim %>% plot(main="Simulated Random Walk") 

rw_sim<-arima.sim(model = list(order=c(0,1,0)),n = 200)
rw_sim %>% plot(main="Simulated Random Walk")