statistical graphics using lattice
play

Statistical Graphics using lattice Deepayan Sarkar Fred Hutchinson - PowerPoint PPT Presentation

Introduction Basic use Overview Case studies Statistical Graphics using lattice Deepayan Sarkar Fred Hutchinson Cancer Research Center 29 July 2008 Deepayan Sarkar Statistical Graphics using lattice Introduction Basic use Overview Case


  1. Introduction Basic use Overview Case studies Statistical Graphics using lattice Deepayan Sarkar Fred Hutchinson Cancer Research Center 29 July 2008 Deepayan Sarkar Statistical Graphics using lattice

  2. Introduction Basic use Overview Case studies R graphics ❼ R has two largely independent graphics subsystems ❼ Traditional graphics ❼ available in R from the beginning ❼ rich collection of tools ❼ not very flexible ❼ Grid graphics ❼ relatively recent (2000) ❼ low-level tool, highly flexible ❼ Grid forms the basis of two high-level graphics systems: ❼ lattice: based on Trellis graphics (Cleveland) ❼ ggplot2: inspired by “Grammar of Graphics” (Wilkinson) Deepayan Sarkar Statistical Graphics using lattice

  3. Introduction Basic use Overview Case studies The lattice package ❼ Trellis graphics for R (originally developed in S) ❼ Powerful high-level data visualization system ❼ Provides common statistical graphics with conditioning ❼ emphasis on multivariate data ❼ sufficient for typical graphics needs ❼ flexible enough to handle most nonstandard requirements ❼ Traditional user interface: ❼ collection of high level functions: xyplot(), dotplot(), etc. ❼ interface based on formula and data source Deepayan Sarkar Statistical Graphics using lattice

  4. Introduction Basic use Overview Case studies Outline ❼ Introduction, simple examples ❼ Overview of features ❼ Sample session to work through, available at http://dsarkar.fhcrc.org/lattice-lab/ ❼ A few case studies if time permits Deepayan Sarkar Statistical Graphics using lattice

  5. High-level functions in lattice Function Default Display histogram() Histogram densityplot() Kernel Density Plot qqmath() Theoretical Quantile Plot qq() Two-sample Quantile Plot stripplot() Stripchart (Comparative 1-D Scatter Plots) bwplot() Comparative Box-and-Whisker Plots barchart() Bar Plot dotplot() Cleveland Dot Plot xyplot() Scatter Plot splom() Scatter-Plot Matrix contourplot() Contour Plot of Surfaces levelplot() False Color Level Plot of Surfaces wireframe() Three-dimensional Perspective Plot of Surfaces cloud() Three-dimensional Scatter Plot parallel() Parallel Coordinates Plot

  6. Introduction Basic use Overview Case studies Univariate Tables Scatter plots Shingles Object The Chem97 dataset ❼ 1997 A-level Chemistry examination in Britain > data(Chem97, package = "mlmRev") > head(Chem97[c("score", "gender", "gcsescore")]) score gender gcsescore 1 4 F 6.625 2 10 F 7.625 3 10 F 7.250 4 10 F 7.500 5 8 F 6.444 6 10 F 7.750 Deepayan Sarkar Statistical Graphics using lattice

  7. Introduction Basic use Overview Case studies Univariate Tables Scatter plots Shingles Object > histogram(~ gcsescore, data = Chem97) 25 20 15 Percent of Total 10 5 0 0 2 4 6 8 gcsescore Deepayan Sarkar Statistical Graphics using lattice

  8. Introduction Basic use Overview Case studies Univariate Tables Scatter plots Shingles Object > histogram(~ gcsescore | factor(score), data = Chem97) 0 2 4 6 8 6 8 10 30 20 10 Percent of Total 0 0 2 4 30 20 10 0 0 2 4 6 8 0 2 4 6 8 gcsescore Deepayan Sarkar Statistical Graphics using lattice

  9. Introduction Basic use Overview Case studies Univariate Tables Scatter plots Shingles Object > densityplot(~ gcsescore | factor(score), Chem97, plot.points = FALSE, groups = gender, auto.key = TRUE) M F 0 2 4 6 8 6 8 10 0.8 0.6 0.4 0.2 Density 0.0 0 2 4 0.8 0.6 0.4 0.2 0.0 0 2 4 6 8 0 2 4 6 8 gcsescore Deepayan Sarkar Statistical Graphics using lattice

  10. Introduction Basic use Overview Case studies Univariate Tables Scatter plots Shingles Object Trellis Philosophy: Part I ❼ Display specified in terms of ❼ Type of display (histogram, densityplot, etc.) ❼ Variables with specific roles ❼ Typical roles for variables ❼ Primary variables: used for the main graphical display ❼ Conditioning variables: used to divide into subgroups and juxtapose (multipanel conditioning) ❼ Grouping variable: divide into subgroups and superpose ❼ Primary interface: high-level functions ❼ Each function corresponds to a display type ❼ Specification of roles depends on display type ❼ Usually specified through the formula and the groups argument Deepayan Sarkar Statistical Graphics using lattice

Recommend


More recommend