Time series data
Let us quickly look at some examples of time series data. We will use some data from Rob J Hyndman, from https://robjhyndman.com/TSDL/.
We will use the age of death of successive kings of England
dataset.
Let us store the time series data as a ts
object:
> kings <- scan("http://robjhyndman.com/tsdldata/misc/kings.dat",skip=3) Read 42 items > king.ts <- ts(kings) > king.ts Time Series: Start = 1 End = 42 Frequency = 1 [1] 60 43 67 50 56 42 50 65 68 43 65 34 47 34 49 41 13 35 53 56 16 43 69 59 48 59 86 55 68 51 33 49 67 77 [35] 81 67 71 81 68 70 77 56 >
Using the scan
 function, we get the data from the URL. Following that, we create a time series object using ts
.
Let us plot the time series:
plot(king.ts)
The standard R plot
function knows how to plot time series data. The time series plot is as shown in the following diagram:
Time series can be either non-seasonal or seasonal.
Non-seasonal time series
Non-seasonal time series tend to have a trend component and...