0
$\begingroup$

I have a data set including daily prices and demand of a commodity. I am sure that, price and demand weekly and monthly changing. So it has a seasonality effect. How can I decompose it by using daily data ?

My data looks like this ;

The row number is 335 . So the last date is 2016-11-30.

I will try to catch a relationship between price and demand. But, not to face with a spurious regression, I have to decompose it first. Using weekly and monthly dummies is an option, but I want to use stl() or decompose() functions, or another one maybe.

I start with : ts(data$Price, start=c(2016,1,1),frequency=365)

But that one also does not work! I couldn't achieve to transform it to timeseries data!

$\endgroup$
  • 1
    $\begingroup$ Please explain the statistical question here. If you are simply seeking R advice, the post is, it seems, off-topic. $\endgroup$ – Nick Cox Mar 6 '17 at 12:57
  • $\begingroup$ Well, I am pretty new in this site. Should I ask R-based questions in somewhere else ? $\endgroup$ – maydin Mar 6 '17 at 13:05
  • $\begingroup$ You should try as.ts(). The link below may help: anomaly.io/seasonal-trend-decomposition-in-r $\endgroup$ – Kyle Shank Jun 7 '17 at 17:39
  • $\begingroup$ The problem is coming from the usage of daily data sets in R. The link you shared is related with montly or yearly data. Daily data is a problematic issue.. $\endgroup$ – maydin Jun 22 '17 at 7:51
  • $\begingroup$ Daily data is not a problem for methods / software that I use . Are you still having a problem ? $\endgroup$ – IrishStat Sep 24 '18 at 14:44
1
$\begingroup$

An alternative is to use a msts object (defined in the forecast package) which handles multiple seasonality time series. Then you can specify all the frequencies that might be relevant. It is also flexible enough to handle non-integer frequencies. Data frequencies
minute hour day week year Daily 7 365.25

Y <- msts(x, seasonal.periods=c(7,365,25)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.