Plotting Time Series in R
While we can explore time series data using commands such as print()
, head()
, tail()
, etc in R, it can be very helpful to plot the time series data as a line chart and explore it visually.
In the following examples, we plot the Microsoft stock data and the quarterly GDP data in two different plots using the plot()
function in R. You can alternatively also use ts.plot()
function.
> plot(msft_ts,xlab="Day",ylab="Closing price", main="MSFT Closing Stock Prices")
> plot(GDP_data,xlab="Time",ylab="GDP", main="GDP Data",type="b")
Both the series show an upward trend over time. The trend for the MSFT stock is not very clear during the first half of the year, however during the send half, it is a clear uptrend. The GDP graph on hand, has an uptrend since the beginning.
Course Downloads
LESSONS
- Financial Time Series Data
- Exploring Time Series Data in R
- Plotting Time Series in R
- Handling Missing Values in Time Series
- Creating a Time Series Object in R
- Check if an object is a time series object in R
- Plotting Financial Time Series Data (Multiple Columns) in R
- Characteristics of Time Series
- Stationary Process in Time Series
- Transforming a Series to Stationary
- Time Series Transformation in R
- Differencing and Log Transformation
- Autocorrelation in R
- Time Series Models
- ARIMA Modeling
- Simulate White Noise (WN) in R
- Simulate Random Walk (RW) in R
- AutoRegressive (AR) Model in R
- Estimating AutoRegressive (AR) Model in R
- Forecasting with AutoRegressive (AR) Model in R
- Moving Average (MA) Model in R
- Estimating Moving Average (MA) Model in R
- ARIMA Modelling in R
- ARIMA Modelling - Identify Model for a Time Series
- Forecasting with ARIMA Modeling in R - Case Study
- Automatic Identification of Model Using auto.arima() Function in R
- Financial Time Series in R - Course Conclusion
R Programming Bundle: 25% OFF
Get our R Programming - Data Science for Finance Bundle for just $29 $39.
Get it now for just $29