-1

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 "-" 
Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
kms
  • 1,810
  • 1
  • 41
  • 92
  • Welcome to SO. It's best practice to provide a [minimal repdroducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) - including your data (may be dummy data) and the code that yields the error. – lukeA Aug 29 '15 at 23:49
  • 1
    Are you passing the column with dates to the `ts` object? if so, there is no need since the dates are defined with `start` `end`, and `frequency`. Perhaps `salests = sales[, 6]`. As Luke recommends, a reproducible example would help. – Whitebeard Aug 29 '15 at 23:55

1 Answers1

-1

Seasonal decomposition of time series by loess can help.

stl(salestsDec,"periodic")
vck
  • 827
  • 5
  • 10