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$
5
  • 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
    Commented Mar 6, 2017 at 12:57
  • $\begingroup$ Well, I am pretty new in this site. Should I ask R-based questions in somewhere else ? $\endgroup$
    – maydin
    Commented Mar 6, 2017 at 13:05
  • $\begingroup$ You should try as.ts(). The link below may help: anomaly.io/seasonal-trend-decomposition-in-r $\endgroup$
    – Kyle Shank
    Commented Jun 7, 2017 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
    Commented Jun 22, 2017 at 7:51
  • $\begingroup$ Daily data is not a problem for methods / software that I use . Are you still having a problem ? $\endgroup$
    – IrishStat
    Commented Sep 24, 2018 at 14:44

1 Answer 1

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 and acknowledge you have read our privacy policy.

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