How to do time series analysis? Part-1

Hi all,

Hope you are familiar with the time series function or you may have heard of time series analysis. In R there is a different R library for time series data analysis [TSDL]. With out loading this library, you can not perform time series analysis. But you don’t have to worry, this is pre-installed library in R software . If not you can simply load this library using.

You will be learning time series analysis in 4 parts. In this article we will learn Reading and Plotting time series data.


Lets learn time series analysis using R step by steps.


  1. Introduction
  2. Reading time series data
  3. Plotting time series
  4. Decomposing Time series
  5. Forecast
  6. ARIMA Models

1).  Introduction:

A time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time.

Time series analysis comprises methods for analyzing time series data in order to extract meaningful statistics and other characteristics of the data. Time series forecasting is the use of a model to predict future values based on previously observed values.

2). Reading time series data: 

I am using this data to show how to read time series data. I have downloaded this data to my local. If you don’t want to download you can load the data fro server also by scanning the URL address.   


Look at the R console output



skip=3 means i have ignored the first 3 rows.

data<-scan(“filename”): you have loaded the data into variable name “data”.

datatimeseries<-ts(data,frequency=1,start=c(1987,1)): The data you have loaded into data variable will be in the format of time series.

Frequency: Different for yearly, monthly and quarterly. for yearly frequency=1, monthly frequency = 12 and for quarterly frequency = 4.

start=c(1987,1): Starting of the time to the end.

3). Plotting Time Series:

Lets plot the above loaded time series data, For plotting you will need graphics library.


If the library is already installed, then give require(“libraryname”).


Look at the time series plot

Will discuss later other steps

If you have any doubts or suggestions please mention in comments section or shoot me an email at

Leave a Reply

Close Menu