I generate this data in R:
set.seed(111)
ds=rnorm(1000)
When I perform Box-Ljung test to test the independency:
Box.test(ds,type='Ljung',lag=log(length(ds)))
it gave me p-value=0.5957, which is reasonable. However, when I perform this:
Box.test(ds[180:299],type='Ljung',lag=log(length(ds[180:299])))
it gave me p-value=0.00162045, which means the autocorrelation of this sub-sequence is significantly different from zero. This also happens for some other subsequences. However, I generated the time series using $rnorm$
function in R with 1000 data points. Could anybody please explain this? Thanks very much in advance.
For the convenience of you readers who are not using R, the sub-sequence ds[180:299] are as followscan be obtained here:
-0.519897495889219 -1.29349097974465 -0.0468977104387991 -0.634996265894026 -0.217702271888753 -1.57484166313679 -0.277503151930296 0.550292207500562 -0.610946617050162 -2.13486545165556 0.699277437883826 1.07719596695356 0.867918157302513 -0.790739378535981 -0.10933017366166 -0.930350061060798 -0.367121264652075 -0.8929143087506 -0.357772808042799 -0.26746212397493 -0.311919498370216 -0.298699732350819 -0.593535614205128 0.826703839100183 -2.16140641596862 -0.921042492750423 0.517163069831033 0.236863388154827 -0.706877224447682 0.818938658902058 0.110031069477065 -0.687460513749019 1.58060254199461 0.344154116514183 1.71047726426708 -0.110721968671133 1.55164613356601 0.548561634536836 1.35698443056714 -0.410115501832514 0.106193236893516 0.288180012014711 -0.297196512205961 -0.162414300766581 -1.66964325616785 -0.542785262204682 0.0688420205291046 -0.456835085720061 -1.08651827074916 -0.681441810261088 -0.21035889031839 0.491107395907189 0.818066552738947 0.0989962802754192 2.53333410090968 0.847856847729228 -0.202718603479748 0.316542035115095 0.819411777618995 0.427625245154347 0.914897267105819 0.949622407349097 0.023592472583806 1.74638087506052 0.688408882333011 0.335241583118977 -0.186711485251211 0.0266904489920433 -0.651630850800417 -0.520016737982009 0.524230138891822 -0.968509365388116 0.911933140046933 0.0928325972602547 -0.532930897557154 -1.66690551561081 -0.574345490354174 0.745013128124539 0.72558962822977 -0.786301031708022 -1.53289189668678 0.778913125974403 -0.812205755314031 -0.877244207964512 -0.0780710713805571 1.20665173929901 -0.0149030972170777 -0.975425851214804 0.486317091650899 0.378129066053436 -0.144207879529667 1.28011618685587 2.62117311234125 0.759605755539568 1.08881315904107 -0.302216637659749 2.61462573464379 0.719864590001654 -0.909858046448242 1.08953518866987 0.363195030671546 0.395034487987832 -1.29941949422705 1.79589941456295 -0.596681688027602 1.35747463480321 -0.910626230494239 0.240325586016053 0.470157837351789 -0.16314431433275 -0.207730536625108 -0.687085114112732 0.233025548701615 -0.0741774111139945 -0.736647415832859 1.00702837555917 -0.598617286667681 -0.659213138747421 -0.515515378372978 -0.181203890129037 http://ykang.hostoi.com/ds120.pdf