r - Pvalue and Xquared is N/A in Box-Ljung test -
box-ljung test data: x-squared = na, df = 20, p-value = na. pvalues , xsquared coming n/a, data values not have zero
if take example :
v <- data.frame(c(12,45,48,31,12,7,78), rnorm(7, mean = 45, sd = 2), c(1,0,0,1,0,0,1), c(0,1,0,0,0,1,0), c(0,0,1,0,0,0,0), c(0,0,0,0,1,0,0)) colnames(v) <- c("col1","col2","alpha","beta","gamma","delta") box.test(v$col1, lag = 20, type = "ljung-box", fitdf = 0)
we :
box-ljung test data: v$col1 x-squared = na, df = 20, p-value = na
now, change our lag.
box.test(v$col1, lag = 1, type = "ljung-box", fitdf = 0) box-ljung test data: v$col1 x-squared = 0.30832, df = 1, p-value = 0.5787
i think lag (20) higher length of time series.
let's take example :
x <- data.frame(rnorm(28000, sd = 0.3), rnorm(28000, mean = 1, sd = 0.3), sample( letters[1:24], 28000, replace=true), sample( letters[1:10], 28000, replace=true), round(rnorm(28000,mean=25, sd=3)), round(runif(n = 28000,min = 1000,max = 25000)), round(runif(28000,0,200000))) colnames(x) <- c("a","b","c","d","e","f","g") _______________________ box.test(x$a, lag = 1000, type = "ljung-box", fitdf = 0) box-ljung test data: x$a x-squared = 1108.8, df = 1000, p-value = 0.009034 _______________________ box.test(x$a, lag = 100000, type = "ljung-box", fitdf = 0) box-ljung test data: x$a x-squared = na, df = 1e+05, p-value = na
Comments
Post a Comment