Visualizing Patterns over Time

Statistics 4868/6610 Data Visualization

Prof. Eric A. Suess

1/27/2015

Introduction

Today we are going to discuss the presentation of time series data.

More R.

Introduction to Inkscape.

Or Adobe Illustrator if you have access to it.

Questions about R

Does anyone have any particular questions about R?

How to run it?

How to create a script? How to save a script?

How to install a library? How to load a library?

install.packages(“ggplot2”)

library(ggplot2)

read.csv(“****.csv” )

Questions about R

Do any undergraduate or graduate students have any particular questions about the following in R?

R Presentation

R Markdown

Both run and include the results from R in the document and can be saved in pdf, html, and posted to RPubs.

I like notebooks!

R Cheatsheets

For the IDE, Shiny, Data Visualization, Package Development, Data Wrangling, R Markdown.

Questions about tableau

Does anyone have any particular questions about tableau?

Try to watch a trainning video with the provided data.

Last time I mentioned TreeMaps

Try the TreeMap tutorial.

Time Series Data

When working with Time Series Data it is useful to consider if the data is quantitative discrete or quantitative continuous.

Discrete Time Series Data are collected at specific points in time on a regular basis.

Continuous Time Series Data is sampled, usually at regular intervals, over time, from a continuous source.

Discrete Time Series Data

Discrete Time Series Data is often presenated using bar graphs where the x-axis is time.

Sometime stacked bar graphs are used to subset the data within the time period, day/month/year.

This is how graphs are often presented in the Wall Street Journal and other newspapers.

Continuous Time Series Data

Continuous Time Series Data is often presented using time plots where the x-axis is time.

Sometime multiple time series are presented on a sigle time plot. Sometime with different scales, right and left.

The dots are connected!

This is how graphs are often presented in the Wall Street Journal and other newspapers.

Examples

Time Series

What to look for in time series data.

  • trends
  • cyclical patterns
  • seasonal patterns
  • irregularity (error, white noise)
  • homoskedasticity (stationarity)
  • heteroskedasticity (transformation, log)

Time Series

Basic models

  • Additive model

    \( Y_t = T_t + S_t + I_t \)

  • Multiplicative model

    \( Y_t = T_t * S_t * I_t \)

What would a log transformation to to the multiplicative model?

In R

decompose( )

Time Series

What is autocorrelation?

What is crosscorelation?

Time Series

What is an autoregression model?

Time Series Books online

InkScape

Try out Inkscape to add description to the plot and the Source.

Not as easy as it looks!

Try it.

Slide With R Code

From the Quick-R website.

Advanced Graphs

Try some plots using ggplot2

ASTSA

From Shumary and Stoffer

library(astsa) 

plot(jj, type="o", ylab="Quarterly 
     Earnings per Share")

plot of chunk unnamed-chunk-1

ASTSA

plot(log(jj), type="o", ylab="Quarterly 
    Earnings per Share")

plot of chunk unnamed-chunk-2