[R] Box-Ljung p-value -> Test for Independence

Ajay Shah ajayshah at mayin.org
Sat Apr 17 13:43:25 CEST 2004

> I'm using the Box-Ljung test (from within R) to test if a
> time-series in independently distributed.

I have window$r.nifty, which is a time-series of returns on the Nifty
market index.

  # Box-Ljung test on Nifty --
  test = Box.test(window$r.nifty, lag=10, type="Ljung");
  cat("Box Ljung prob value: ", test$p.value, "\n")

  # Runs test on Nifty
  test = runs.test(factor(sign(window$r.nifty)));
  cat("Runs test prob value: ", test$p.value, "\n")

Ajay Shah                                                   Consultant
ajayshah at mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi

More information about the R-help mailing list