1. Trend spotting!
Let's try some trend spotting!
2. Trends
Some time series do not exhibit any clear trends over time, as seems to be the case for figures A and B.
However, many others do.
3. Trends: linear
Here are examples of series with Linear Trends over time. On the left, you see an Upward trend, and on the right, a Downward trend.
4. Trends: rapid growth
Upward trends may be increasing more quickly than linear. Figures A and B are two examples of Rapid Growth Trends over time. Rapid decay is also a possibility, but it is not as common in most applications.
5. Trends: periodic
Some series can exhibit Periodic or Sinusoidal Trends over time. In figure A you see a periodic series with a cycle length of about 75 observations. In figure B the series oscillates more quickly and the cycle length is much smaller.
6. Trends: variance
Time series can also exhibit trends in variability. Figures A and B both show examples of series with Increasing Variance Trends over time.
7. Sample transformations: log()
Now let's discuss a few simple data transformations that can be used to remove or filter some of the common trends we just discussed.
The log() function in R, which is the natural logarithm transformation, can linearize a rapid growth trend. You can see the rapid growth on the left is now a linear time trend on the right. The log transformation can also stabilize a series that exhibits increasing variance. The main restriction is that the log transformation is only defined for positively valued time series.
8. Sample transformations: diff()
The diff() function in R, which is the first difference transformation, can remove linear trends. You can see the linear trend that appears in figure A is eliminated in figure B. The series in figure B is called a difference series or a change series. It's values represent the increments or changes between consecutive observations in the original series. Of course, a first difference series will always have one fewer observations than the original series.
9. Sample transformations: diff(…, s)
Finally, for periodic series, the diff() function in R with the additional seasonal argument S, can remove periodic trends. This is called the seasonal difference transformation. The series in figure A has a periodic or seasonal pattern with cycle length 4. After applying seasonal differencing with S equal to 4, we see the series in figure B does not exhibit any periodic trends.
10. Let's practice!
Great! Now let's practice trend spotting!