简体   繁体   中英

remove seasonality from weekly time series data

I need to decompose a series to remove seasonality. The series has 2 columns date and volume.

This is what my time series object looks like:

salestsDec <- ts(salests, frequency=52, start=c(2010, 1), end=c(2014,12))

I ran the decompose() function on a 'ts' object.

salests = sales[, c(1,6)]
View(salests)
salestsDec <- ts(salests, frequency=52, start=c(2010, 1), end=c(2014,12))
salestsDec <- decompose(salestsDec, type=c("additive"))
plot(salestsDec)

Upon, running the decompose() function, I get a list of 6 components, observed, trend, seasonal, random for both date and volume. I should only be seeing, observed, trend, seasonal and random component for Volume in my plot.

I've attached an image of what the plot looks like.

Moreover, when I try to remove seasonal component from the series, I am getting an error. It appears that it's the same underlying issue.

Error:

Error in salests - salestsDec$seasonal : 
  non-numeric argument to binary operator
In addition: Warning message:
Incompatible methods ("Ops.data.frame", "Ops.ts") for "-" 

黄土对时间序列的季节性分解会有所帮助。

stl(salestsDec,"periodic")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM