Feeding an hourly zoo time-series into function stl()

前端 未结 1 1461
眼角桃花
眼角桃花 2021-01-14 12:15

Before you ask, yes I need to show this much data. stl() requires two periods of data. In this case, one period is 24 values, so stl() wants at least 48 values.

1条回答
  •  -上瘾入骨i
    2021-01-14 12:45

    Use a time representation for which is a full cycle is 1 so for hourly data with a frequency of 24 a unit of time should correspond to a day. chron works that way so:

    library(zoo)
    library(chron)
    
    z <- read.zoo(text = texinp, header = TRUE, sep = ",", FUN = as.chron)
    stl(z, "per")
    

    0 讨论(0)
提交回复
热议问题