MC exercise

In this Monte Carlo exercise, we empirically assess the sampling distribution of \(\hat{\phi}\), the OLS estimate of the AR(1) coefficient \(\phi\): \[ y_t = \phi y_{t-1} + \epsilon_t \qquad \epsilon_t \sim N(0,1). \] When \(|\phi|<1\), it is well known that \[ \hat{\phi}|\phi \sim N\left(\phi,\frac{1}{\sum_{t=1}^n y_{t-1}^2}\right) \ \ \ \mbox{and} \ \ \ t = \sqrt{\sum_{t=1}^n y_{t-1}^2}(\hat{\phi}-\phi) \sim N(0,1) \] Let us generate \(S=100\) samples of size \(n\) from the above AR(1) model and compute the \(t\) statistic for different samples sizes \(n\) and difference persistence parameter \(\phi\). The following plot contrasts the standard normal against the sampling distribution of the \(t\) test above. Notice that when \(\phi=0.5\) the two densities are almost identical. On the other hand, when \(\phi=1\) (unit root) the sampling densities is shifted to the left of the standard normal density.

S  = 1000
for (phi in c(0.5,1.0)){
  for (n in c(100,200,1000)){
    tt = rep(0,S)
    for (s in 1:S){
      y = rep(0,n)
      for (t in 2:n){
        y[t] = rnorm(1,phi*y[t-1],1)
      xtx     = crossprod(y[1:(n-1)])
      xty     = crossprod(y[2:n],y[1:(n-1)])
      phi.hat = xty/xtx
      tt[s]    = sqrt(xtx)*(phi.hat-phi)
    L = round(quantile(tt,0.05),3)
    title(paste("phi=",phi," - n=",n,sep=""))
    xxx = seq(-5,5,length=200)