Strange results of Ljung-Box test (for white noise process) Ljung Box test tells that the following time series is white noise (p=0.9746845 for the current run). How could this be?
x=rep(10,1000)
x[500]=-10
Box.test(x,type="Ljung-Box")$p.value


 A: Like other hypothesis tests, the Ljung–Box test doesn't tell us the null hypothesis is true, or even likely to be true; but calibrates a test statistic measuring departure from the null hypothesis in a direction of interest by telling us how probable it is that it would exceed (or equal) the value observed under hypothetical repetitions of the experiment or study, if the null hypothesis were true. The L–B test statistic uses the sum of squared sample autocorrelations up to a given lag to investigate autocorrelation in the time series, given a null hypothesis of no autocorrelation at any lag.  In your case the spike at $x=500$ gets averaged out in the sample autocorrelations & hardly affects the test statistic at all (check the auto-correlation plot with acf). This time series isn't white noise because its mean is far from zero (do a $t$-test if you like).† (It's also not Gaussian noise, clearly.)
The moral of the story is that there's no single test for every way the null hypothesis can be wrong. Use an outlier test when you want to test for outliers, a location test to test for zero mean, & the L–B test to test for non-zero auto-correlations.
† Or if you define white noise as having constant mean, there's no reason to say this time series evidently isn't WN.
A: At once point, I was looking for a good white noise detector to test against a phenomena that wasn't white noise but I thought might approximate it.
I ran across Prof Don Percival lecture notes (sorry, I lost the pointer to which lecture in which class, but it's somewhere in here:)
https://staff.washington.edu/dbp/
In one of his lectures, he gave several different white noise algorithms.
My take home lesson, is there are a number of plausible ways of measuring for white noise, but it appears there is no one good sure fire way of detecting it.  IMHO, this is especially true if you throw in the sampling rate or other things that may create artifacts.
I suspect there may be additional math that needs to be developed before we get a robust white noise detector.
