Testing the independence of a time series I’d like to test whether my time series of consecutive payments is independent or not and thought that since this is a pretty common condition in statistics it should be easy. Well, turns out is isn’t – at least for me.
Now I found these earlier posts which have driven me into the Ljung-Box or Box-Pierce direction:
Testing normality and independence of time series residuals
What is a reasonable independence test for a time series?
I'm working with R and at first I wanted to check the test and if I correctly understand its p-value. So I thought of the following vector and expected a quite low p-value but now I’m surprised about the high number (0.5391) and its implication on not to reject the hypothesis of “independently distributed”.
library(stats)
test<-c(1,1,1.1,1,1,1,1,1,1.1)
Box.test(test,lag=1,type = "Ljung-Box")

So what am I getting wrong or is there a different/better way to test the independence of my time series where I don't know its distribution?
 A: If you want to conduct a hypothesis test to evaluate whether a time series has an autocorrelation that differs from 0 then the Ljung-Box test is a perfectly reasonable approach.
However, I'm not sure why you would expect your vector to display a strongly autocorrelated signal, as there's basically no variation in it all.
Try the test again with one of R's built in datasets that show a clear autocorrelation signal, such as in my example below using monthly temperature data over many years.
Box.test(nottem, lag = 1, type = "Ljung-Box")

Note that at this and other lags you'll find a very small p-value, which (as you seem to have been expecting) indicates that if you assume the null hypothesis to be true (i.e. the autocorrelation to be 0), then the probability of observing this data or more extreme data (i.e. more autocorrelated data) is very small, and therefore it's reasonable to conclude the data are highly likely to be autocorrelated.
To understand the autocorrelation pattern further I would also strongly suggest initially looking at the autocorrelation and partial autocorrelation function (see https://en.wikipedia.org/wiki/Partial_autocorrelation_function for a good explanation), which can be done easily in R with the acf and pacf function as shown below for the same data. These will help you understand the extent of the lags in your data.
acf(nottem)
pacf(nottem)

