# [R] Not able to understand the behaviour of boot

From: Ajay Shah <ajayshah_at_mayin.org>
Date: Sun, 27 May 2007 10:29:43 +0530

Folks,

I have a time-series of 875 readings of the weekly returns of a stock market index (India's Nifty). I am interested in the AR(1) coefficient. When I do arima(r, order=c(1,0,0)) I get a statistically significant AR1 coefficient.

If we apply the ordinary bootstrap to this problem, this involves sampling with replacement, which destroys the time-series structure. Hence, if we do bootstrap inference (using the ordinary bootstrap) we ought to get a 95% confidence interval which is roughly symmetric about zero. Yes?

The program:

library(boot)
AR1.boot <- function(x, d) { arima(x[d], order=c(1,0,0))\$coef }     load(url("http://www.mayin.org/ajayshah/A/nifty_weekly_returns.rda"))     arima(r, order=c(1,0,0))
b <- boot(r, AR1.boot, R=5000)
boot.ci(b, type="basic")

gives me:

> arima(r, order=c(1,0,0))

Call:
arima(x = r, order = c(1, 0, 0))

Coefficients:

```         ar1  intercept
0.0718     0.3061
s.e.  0.0337     0.1392

```

sigma^2 estimated as 14.61: log likelihood = -2414.86, aic = 4835.72
> b <- boot(r, AR1.boot, R=R)
> boot.ci(b, type="basic")

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 5000 bootstrap replicates

CALL :
boot.ci(boot.out = b, type = "basic")

Intervals :
Level Basic
95% ( 0.0760, 0.2109 )
Calculations and Intervals on Original Scale

I find it very strange that the 95% confidence interval runs from 0.076 to 0.2109. I had expected that it should be symmetric about 0. What am I missing?

As an aside, how would you set about using tsboot() to obtain inference for this AR(1) coefficient?

```--
Ajay Shah                                      http://www.mayin.org/ajayshah
ajayshah@mayin.org                             http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help