3
$\begingroup$

I am testing autocorrelation of a raw time series, not the residuals with Ljung-Box and Breusch-Godfrey tests. The problem is that I am getting contradicting p-value results for some series:

Ljung-Box

> x<-c(-1.26,-1.33,0.63,1.08,1.65,2.86,0.77,1.06,-0.25,0.44,-0.81,0.18,1.02,0.44,0.88,1.61,0.15,-0.95,-0.92,2.13,1.12,-0.18,0.9,0.2,0.59,-0.35,0.78,-2.14,-1.66,0.36,1.24,-0.57,-0.56,-1.12,-0.07,0.93,-0.19,-1.03,1.26,1.14,1.95,1.9,1.06,0.53,1.44,0.33,0.3,-0.86,-2.05,0.3,-0.46,2.24,-1.53,1.9,0.1,-0.35,0.16,1.46,2.53,0.75,1.23,0.8,-8.83,-1.72,1.07,-0.77,5.6,5.27,5.66,2.98,3.61,4.56,7.6,2.88,3.04,2.52,2.16,0.55,2.19,0.39,2,4.27,1.24,1.93,2.05,2,0.66,-2.8,2.22,2.93,2.32,3.6,1.57,3.64,2.01,0.05,1.85,0.65,-0.48,1.54,2.17,3.96,4.64,3.91,4.58,1.49,1.75,2.48,4.75,-0.41,0.32,2.16,1.61,2.59,1.62,1.36,1.08,2.02,1.46,-0.15,0.75,0.59,1.18,2.33,2.25,0.49,0.93,0.89,1.95,1.24,1.03,0.3,2.06,1.39,1.28,1.43,-1.12,-1.39,6.31,2.45,0.25,1.77,-1.85,-1.65,0.49,0.44,-2.75,-0.25,0.64,3.18,-0.75,-0.78,4.41,2.43,1.85,1.29,1.99,2.62,1.11,0.88,-0.15,2.01,1.15)
> lb<-Box.test(x, lag=1, fitdf=0, type="Ljung-Box")$p.value
> lb
[1] 3.185489e-07

Breusch-Godfrey:

> xlag <- cbind(
+     filter(x, c(0,1), method= "conv", sides=1),
+     filter(x, c(0,0,1), method= "conv", sides=1),
+     filter(x, c(0,0,0,1), method= "conv", sides=1))
> bg1 <- bgtest(x ~ 1+xlag, order=1, type="F", fill=NA)$p.value
> bg1
[1] 0.4321826

What am I doing wrong?

Thanks!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.