How to determine the lag in the time series?

I am working on a time series problem and want to expand it to get some basic information about lag. The goal is to evaluate the lag of the output variable based on changes in the change variable as part of the data.frame example below. The full data.frame has more data, but it is all weekly and follows the same structure as in this example.

year <- c(2010,2010,2010,2010)
week <- c("P7W1","P7W2","P7W3","P7W4")
output <- c(3295,4379,4284,4832)
change <- c(1912,2177,1587,2708)

timeTest <- data.frame(year,week,output,change)

I created a time series object with the following.

timeObject <- ts(timeTest, start=c(2010,7), frequency=52)

However, when I was doing the decomposition (timeObject), I got an error message stating that I had at least 2 periods. Something is obviously missing me, any advice is welcome.

+3
source share
1 answer

() stl(), . 1/. , , = 52, , .

, () 103 :

decompose(ts(runif(103), frequency=52))

Error in decompose(ts(runif(103), frequency = 52)) : 
  time series has no or less than 2 periods

() 104 :

decompose(ts(runif(104), frequency=52))

$seasonal
Time Series:
Start = c(1, 1) 
End = c(2, 52) 
Frequency = 52 
  [1] -0.015447737  0.392006955  0.185528936  0.372505618 -0.079588619
  [6] -0.351928149 -0.472617951 -0.306461367 -0.475596801  0.266197693
 [11]  0.167468113 -0.332837411 -0.427845149 -0.001199151  0.276361737
...
$type
[1] "additive"

attr(,"class")
[1] "decomposed.ts"

PS. acf(), . , . :

acf (ts (runif (100), = 52))

enter image description here

+6

All Articles