# How to show the inconsistency of the OLS estimator for unit-root AR(1) processes by simulation?

From what I understand, OLS gives consistent estimates for stationary AR(1) time series but not for unit-root ones. I am trying to illustrate this phenomenon with a small simulation in R but the OLS estimates in the unit-root case seem alright:

res <- c()

for (i in 1:1000) {
ar <- c(0)
for (j in 2:1000) ar[j] <- 1 * ar[j - 1] + rnorm(1)