Time Series Analysis with R

I am new to R following the PDF analysis of time analysis using R, Walter Zucchini. I have data coming from the sensor, in particular, I can receive data every minute or every 5 seconds. Then I want to use the ts() command to create a time series of these values. Thus, the syntax should be data1mints <- ts(data1min ,freq = 525600) , where 525600 is the minutes in the regular year.
after that I try to build this plot(stl(log(data1min), s.window = "periodic")) command plot(stl(log(data1min), s.window = "periodic")) , but R tells me that

is not periodic or has less than two periods

To be more precise, I have data from March 20 to March 28, so I did not have complete year data, but I think that there is enough time for this to analyze what happens every minute.

What am I wrong?

+4
source share
1 answer

The error message tells you what is wrong - you have less than two periods.

For instance,

 # this works since there are 3 periods freq <- 100 ny <- 3 # no of years, ie periods n <- ny * freq set.seed(13) tt <- ts(rnorm(n), freq = freq) s <- stl(tt, "periodic") # this issues error since there are less than 2 periods. (We have changed ny to 1.) freq <- 100 ny <- 1 ## n <- ny * freq set.seed(13) tt <- ts(rnorm(n), freq = freq) s <- stl(tt, "periodic") 
+5
source

Source: https://habr.com/ru/post/1500542/


All Articles