Reputation:
I have some daily data which looks like this:
> head(daily_leads)
date gross.leads day_of_week month
1 2007-01-01 6427 2 1
2 2007-01-02 7111 3 1
3 2007-01-03 7367 4 1
4 2007-01-04 7431 5 1
5 2007-01-05 7257 6 1
6 2007-01-06 7231 7 1
There are some clear intra-week trends and the same day of the week usually corresponds to similar levels (Friday's are similar counts to Fridays). There are also some trends going on here. Also there are trends over the course of the year.
What is the correct way to set up a time-series object in R in order to make forecasts in my case? When I try this:
> leads <- ts(daily_leads$gross.leads, frequency = 1/7)
> q <- decompose(leads)
Error in decompose(leads) : time series has no or less than 2 periods
I'm not sure if I am setting it up correctly but I want the time-series object to reflect the seasonality within the week and year. Any help would be much appreciated. I have 2543 observations of the data.
Upvotes: 1
Views: 163
Reputation: 31820
You need frequency=7
. In time series, the frequency
is the number of observations per seasonal period.
Upvotes: 3