# NOT RUN {
set.seed(1234)
## A function to create a time series
ar.series <- function(phi,epsilon) {
n <- length(epsilon)
series <- numeric(n)
series[1] <- epsilon[1]/(1-phi)
for(i in 2:n) {
series[i] <- phi*series[i-1] + epsilon[i]
}
return(series)
}
n <- 100
## Stationary persistent time-series
yt <- ar.series(0.95,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="summation")
Sys.sleep(5)
## Stationary independent time-series
yt <- ar.series(0.0,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="summation")
## Stationary persistent time-series
yt <- ar.series(0.95,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="integration")
Sys.sleep(5)
## Stationary independent time-series
yt <- ar.series(0.0,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="integration")
# }
# NOT RUN {
# }
# NOT RUN {
<!-- % enddontrun -->
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab