Visualizing time series data
Visual depiction of time series is important to get early insights into the nature of the data. Visualization of time series is very simple in the sense that simply plotting the time series variable against the time itself gives insight about the behavior of the data. The R function plot.ts
can be applied on the ts
objects and the time series can be visualized. For the overseas visitors problem, we plot the number of visitors for the month against that time instance.
Getting ready
The reader needs to have the osv
object from the previous session in the current environment.
How to do it...
- We will now apply the
plot.ts
function to obtain the visual depiction of the overseas data. - Run the following line in the R session:
plot.ts
(osv, main="New Zealand Overseas Visitors",ylab="Frequency")
The output given by running the R line is shown in the following diagram:
It may be seen from the diagram that a certain pattern is recurrent and that cycle appears as 12 data points...