SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
A graphical grammar +
      graphical inference =
a grammar of graphical inference?


   Hadley Wickham, Rice University
1. Motivation
2. Resampling methods
  (graphical inference)

3. Graphical display
  (grammar of graphics)

4. Future work
5


 8



 6

                                                              ●
                                                                   ●        ●

 4                                                       ●         ●
                                                         ●
                                                     ●        ●
                                                              ●
                                                              ●
                                                     ●
                                                 ●       ●
                                                              ●
                                                             ● ●
                                                                       ●●
 2                                                           ●                                                  species
             ●                                   ●
                                                 ●                                                               ●   Concinna
     ●

                 ● ●                ●
                                                                                                                 ●   Heikert.
         ●
 0                ●    ●
                                ●
                                ●           ●                                           ●               ●        ●   Heptapot.
           ●                                                                        ●
          ●●                ●                                                                   ●
                                                                                                ●       ●
         ●              ●                   ●
                            ●●                                                          ●
                                                                                        ●           ●       ●
                  ●
                 ● ●                                                                        ●           ●
                                                                                                ●       ●
                    ●                                                               ●●
−2               ●
                 ●          ●
                                                                                            ●
                                                                                                ●       ●
                                        ●
                                                                                    ●
                            ●
                                ●                                                   ●
                  ●                                                                         ●


−4



−6



         −6            −4                   −2       0                 2        4                   6
1                           2                    3                   4
 8
 6
 4
               ●                                                 ●● ● ●
 2             ●●
              ●●●    ●                     ●●
                                        ● ●● ● ●
                                             ● ●                  ●●●
                                                                 ●● ●
                                                                    ●●               ● ●
                                                                                    ● ●
              ● ●
             ● ●
             ●●●●● ●
              ● ● ●●                         ●●●
                                          ●● ● ● ●
                                              ●                   ●● ●             ●●● ●● ●
                                                                                      ● ●
                                                                                       ● ●
              ●
             ●● ●  ● ●                   ● ●●●●
                                            ●● ● ●
                                                                   ●●
                                                               ● ●●● ● ●
                                                                  ● ● ●●
                                                                   ●●●
                                                               ●●●●● ●               ●●●
                                                                                    ●● ●●●
                                                                                   ● ●●●● ●
                                                                                         ●
                                                                                    ●●●● ● ●
 0           ● ● ●
            ●● ● ●●
            ● ●● ●●
              ●●● ●
                  ●●
                ● ●●                      ● ●
                                        ●● ●●
                                              ●●
                                              ●●
                                              ●
                                         ●● ● ●
                                        ● ●● ● ● ●
                                           ● ●
                                                                ● ●● ●
                                                                ● ●●● ●
                                                                 ●● ●●
                                                                                     ●● ●
                                                                                    ●●
                                                                                    ●●
                                                                                      ●●
                                                                                          ●
                                                                                          ●●
             ● ●●
             ●● ●●                        ●● ●
                                            ● ●                   ● ●●
                                                                ●●● ● ●
                                                                   ● ●
                                                                   ●●                 ●● ●
                  ●                       ●●●●●                    ●                 ●●
                                                                                   ●●● ●
                                                                                     ●● ●
                                                                                       ●
−2           ●●
                ●
                                                                   ●
                                                                                      ●
                                                  ●
−4
−6

                  5                           6                    7                   8
 8
 6
 4
                    ●● ●
                   ● ●
                                                                                               species
                 ●●●
                 ●● ●
                  ●●                       ●
                   ● ●
                    ● ●
 2               ●●
                                            ● ●
                                             ●
                                           ●● ●
                                                                  ●
                                                                ●● ●                   ●
                                                                                  ● ● ●●
                                                                                       ●●       ●   Concinna
     ●
       ●         ●                           ● ●
                                            ● ●●
                                               ●●
                                                                   ●
                                                                 ● ●
                                                             ●● ●● ●
                                                               ● ●
                                                                 ●                    ●●
                                                                                  ●●●● ● ●
                                                                                     ● ●
                                                                                     ●● ●
                                                                                     ●● ●
                                             ●● ● ●          ●● ●                     ●●
 0   ●● ●● ●
        ●
        ● ●
                                           ●●●● ●
                                         ●●● ●●● ●
                                            ●●●●●
                                           ●●●● ●
                                                           ● ●● ●● ●
                                                              ●● ●
                                                             ● ● ●●
                                                             ● ● ●●
                                                                 ●              ●● ● ●●●●
                                                                                     ●● ●
                                                                                      ●●
                                                                                    ●● ●● ●
                           ● ●             ●● ● ●
                                             ●●●              ●● ●
                                                                 ●
                                                            ●●●●● ●                             ●   Heikert.
       ●
       ● ●
       ● ●● ●
      ●● ●                 ● ●●
                           ● ●● ●
                                          ●● ● ● ●
                                           ● ●
                                          ●● ● ●
                                                                ●
                                                                ●● ●
                                                              ●●●● ●
                                                               ●●●●              ● ●●● ●●
                                                                                     ●● ●
                                                                                 ● ●●●●● ●
                                                                                   ● ● ●
        ●                   ● ●
                             ●
                           ●●●              ● ● ●
                                         ●● ● ●                ●●●                   ● ●●
                                                                                      ●
−2      ●● ● ●
        ●                  ●● ●
                           ● ●
                                            ●                   ●
                                                                ●                       ●
                                                                                        ●
        ● ●●               ●●                                                                   ●   Heptapot.
−4
−6

                  9                         10                    11                  12
 8
 6
 4
                                                ●
                ●
 2             ●●
              ● ●
             ● ●● ●
            ● ●● ● ●
                  ●
                                               ●
                                              ● ●
                                        ● ●●●●●
                                                                    ●
                                                               ● ●●● ●
                                                                  ●● ● ●
                                                                  ●●●                ● ●
                                                                                  ● ● ●●
                                                                                  ●●● ● ●
                                                                                     ● ●●
                                           ●● ●
                                             ● ●                   ●           ●
             ●●●● ●●
              ●●● ● ●
               ● ● ●                     ● ●●●● ●
                                             ●●
                                            ●● ●
                                            ●●●●●
                                             ●●
                                                           ●    ●●
                                                                 ●●●●
                                                                 ●●●●             ●●●●●
                                                                                     ●
                                                                                   ● ●● ●
                                                                                     ●●
                                                                                      ●
 0           ●●● ●●
                ●                          ● ●
                                         ●● ●● ●
                                          ● ●●                     ●
                                                               ● ●●●●● ●
                                                               ●●●●●
                                                                  ● ●              ●● ● ●
                                                                                 ● ●●●● ●
                                                                                     ●
                                                                                   ● ● ●●
              ●● ● ●
            ● ●●●● ●●                        ●●
                                          ● ●●                 ●● ●● ●● ●
                                                                  ● ●               ●● ●
               ●● ●
              ●●● ●●
              ●● ● ●
               ●
               ●                           ●●●● ● ●
                                               ● ●
                                          ●● ● ●
                                                               ● ●●●●
                                                                 ● ●●●
                                                                  ●●             ● ●●●● ●
                                                                                    ● ●●
                                                                                ●●● ● ●●●
                                                                                     ●●
             ●●● ●                         ●● ●                     ●                ●●
−2             ●                              ●
                                            ●
−4
−6

     −6 −4 −2 0 2 4 6               −6 −4 −2 0 2 4 6   −6 −4 −2 0 2 4 6     −6 −4 −2 0 2 4 6
1                               2                           3                           4

                                          ●
 4                                                                  ●            ●
                                       ● ● ●                                     ●●                       ●
                                                                                                        ●● ●
                     ● ●● ●                    ●                       ●
                                                                           ● ● ●
                                                                               ●
                                        ●    ● ●                                                         ●
 2         ●
                ● ●
                 ● ●
                 ●
                 ●
                ●●
                                              ●        ●
                                                        ●
                                                             ●
                                                                      ●●     ●● ●
                                                                                     ●                    ●●● ●
                                                                                                            ●
                                                                                                            ● ●
        ● ●●         ●                     ●
                                          ●●         ●
                                                    ● ● ●               ●● ● ●
                                                                            ●                         ●●● ●
                                                                                                               ●
     ● ●● ●      ● ● ●●                   ●            ●●                                            ● ●●
          ● ● ● ●● ●●
                 ●                           ● ● ● ●●                ●       ● ●      ●●          ● ●● ● ●     ●●    ●
                                                ●      ● ● ●            ● ● ● ● ●● ● ●
                                                                                    ● ●          ●      ●       ● ● ●  ●
 0        ●         ● ●
                      ●
              ● ● ● ●●●●
         ●●●● ●                               ●● ●
                                        ● ● ●● ●
                                               ●
                                              ●● ●
                                                        ● ●           ● ●
                                                                         ●
                                                                                     ● ●
                                                                                     ●        ●      ● ●●
                                                                                                  ● ●●
                                                                                                     ●● ●
                                                                                                       ●
                                                                                                                 ●
                                                                                                                  ●
               ● ●● ●                                      ●                  ●                 ● ●● ●          ●●
          ● ● ● ●●
           ● ● ●                          ● ●● ● ●●
                                          ●
                                          ● ●
                                           ●
                                           ●      ●
                                                  ●●      ●            ●● ● ●●
                                                                       ●●●● ●● ●●
                                                                          ●        ●●           ●         ●       ●
                  ●                                                                                ● ●              ●
             ●● ● ●                          ●● ● ●
                                             ●                       ●    ●●
                                                                                                 ●           ● ●●● ●
−2           ●
                 ●● ●
                 ●●        ●
                                             ●
                                                ●                        ●●
                                                                                     ●
                                                                                        ●
                                                                                                       ●
                                                                                                        ●●
                                                                                                                  ●
                    ●                                                    ●
                                                                         ●
                                              ●                           ●                           ●          ●
                                                                                    ●
−4

                  5                               6                           7                           8

                    ●
 4                ●
                   ●
                                                ●
                                                                                 ●    ●                        ●   ●
                                              ●
                ●● ●                        ●                                        ●                                     species
                                              ● ● ● ●                         ● ●                ●● ●
 2           ●   ●● ● ●●                       ●●
                                                                             ●● ●
                                                                                ●
                                                                                                    ●
                                                                                                             ●● ●
           ● ●●       ●                      ● ●●                         ● ● ● ●               ●●●
     ●●●     ●    ●●
                 ● ● ●                  ●● ●● ● ● ● ●●
                                            ●     ●                      ● ● ●●
                                                                   ●● ● ● ●                         ● ●●
                                                                                                         ● ●● ● ●
                                                                                                 ●● ● ● ●●     ● ●
                                                                                                                            ●   Concinna
                  ●                               ●● ●
                                              ● ●● ● ● ●         ●   ●●● ●●● ● ● ● ●
                                                                            ●●                    ●             ● ●●
 0   ● ● ●
         ●
                        ● ●
                        ● ● ●●         ●
                                       ●     ● ●      ● ●            ●● ●
                                                                      ●     ●
                                                                                               ● ● ● ● ●● ● ●
                                                                                                          ●●
      ● ●● ●
       ● ● ●           ●● ●
                        ●             ● ● ● ● ● ●● ●●
                                         ●
                                                      ●●              ● ● ●● ●
                                                                      ● ●● ●●● ●●                       ●          ●
                                                                                                        ●● ● ● ● ● ●
                                                                                                               ●
                                                                                                                            ●   Heikert.
        ●● ●
         ●●
        ● ● ●
                        ● ●● ●
                            ●         ● ●● ●  ●
                                           ● ●● ● ●●
                                                      ● ●                 ●
                                                                       ● ● ●
                                                                          ●        ●                  ● ●● ●●
                        ●           ●                                         ● ●● ●                  ●      ●
         ●
        ●●●                 ● ●                   ●                           ●     ●●              ●● ● ● ● ●
−2            ●
                          ●
                          ●
                                        ●●
                                                    ● ●
                                                    ●
                                                       ●                ●
                                                                        ●        ●
                                                                                   ●                ●
                                                                                                         ●
                                                                                                         ●    ●             ●   Heptapot.
       ●                ●                                                   ●      ●                     ●
                                                                                                     ●
−4

                  9                            10                            11                          12

 4                ●                            ●                             ● ●
                                              ● ●                       ●   ●    ●
                 ● ● ●  ●                                                                           ●●
                                                ●
                                               ● ●                         ●● ● ●                    ●● ●
                                                                                                       ●
                   ● ●                                                        ● ●
 2                ●●
                    ●                       ●                           ● ●                           ●
           ●
           ● ●● ● ●● ● ●
                                            ● ●●●
                                               ●           ●              ●● ●  ●                   ● ●● ● ●
                                                                                                         ●●         ●
                     ●●                  ●     ● ●● ●●                   ●         ● ●●             ● ●            ●
               ●         ●                ●●                                  ●                      ●      ●● ● ●
          ● ●      ●● ●●● ●           ●        ● ● ●
                                           ●●● ● ●● ●                   ● ● ●  ●    ●             ● ●●
                                                                                                  ●        ●    ●    ●
 0        ●●
       ●● ● ●   ●                      ●●
                                       ● ● ● ● ●● ●
                                     ● ●
                                                                    ● ●●    ●
                                                                            ●         ●
                                                                                      ●
                                                                                      ●●           ●●      ●●●●●● ● ●
                                                                                                             ●
              ●      ●●
                          ●            ●● ● ● ●    ●
                                                        ●
                                                         ●       ● ● ●● ● ●
                                                                    ● ●           ● ● ●          ● ●●         ●
                                                                                                              ●
     ●    ● ● ●●
               ●       ● ● ●            ●
                                        ●●          ●●              ●● ●            ● ●●         ●           ●
     ● ● ●●●            ● ● ●
                        ● ●            ●● ●         ●                    ●      ●     ●          ● ● ● ● ●● ●     ●
                ● ●
                ● ●●                         ●●     ● ●● ● ●         ● ●● ●       ● ●  ●           ●         ●
                                                                                                             ● ● ●●
−2      ●          ● ●      ●                          ●               ●
                                                                      ● ●
                                                                     ●●            ●●         ●● ● ●
                           ●             ●                                               ●       ●     ●
                       ●                 ●●       ● ●                         ●● ●
                          ●
                                                                                                   ●
−4

     −4 −2       0     2        4   −4 −2      0      2   4      −4 −2       0       2    4   −4 −2       0    2       4
Problem
Want to make it very easy to make these
types of display - should be able to create
as easy as doing as simple numerical test.
With the right tools, it turns out to be really
easy!
Two basic problems: how to do
resampling under the null, and how to
define the graphic.
Resampling
Many resampling methods have
particularly elegant expression in R code.
For example, if null hypothesis is that of
independence:
df <- transform(df, resp = sample(resp))
However, better to generalise the pattern.
Generalisation
permute_var <- function(var) {
  function(df) {
    df[[var]] <- sample(df[[var]])
    df
  }
}

f <- permute_var(quot;mpgquot;)
f(mtcars)
permute_var(quot;mpgquot;)(mtcars)
Advantages
Separate description from
implementation.
Call describes action.
Can later replace implementation if better
approach discovered.
Unimportant details concealed.
n resamples
Each method gives us a single resample,
but we need n.
Trivial to repeat n times with rdply() from
the plyr package.
(rdply() is a generalisation of
replicate() that returns a data frame
with a column that labels each replicate.)
Overall
resamp <- function(true, method, n = 19, pos = sample(n + 1, 1)) {
  samples <- rdply(n, method(true))
  if (missing(pos)) {
    message(quot;True data in position quot;, pos)
  }
  add_true(samples, true, pos)
}

add_true <- function(samples, true, n) {
  samples$.n <- with(samples, ifelse(.n >= n, .n + 1, .n))
  true$.n <- n

    all <- rbind(samples, true)
    all[order(all$.n), ]
}

                                  Will see application shortly
Other nulls

Need functions for other common null
hypotheses.
Experimental null_model(), which
computes rotation residuals given a
specified linear model. (Demo a little
later)
Display

How is the plot of the simulated data with
true data different from a single plot?
Just need to repeat the same display n
times and label appropriately.
This is easy if we have a description of
the plot, independent of the data.
Grammar of Graphics
This is one principle of the grammar of
graphics: should describe the graphic we
want, not how to create it.
Implemented with the ggplot2 package in
R.
Easy to modify a graphic after it has been
created. For graphical inference, we need
to change the data and facetting.
Example
●
      35
                   ●




      30
                   ●

           ● ●



               ●
               ●
               ●
      25   ●
             ●
             ●
             ●
           ●
           ● ●
                                ●
           ●                                                                                                 factor(year)
                 ●●
                              ●
cty




                             ●
                 ●
                 ●         ●
                           ●
                             ●●
                             ●
                                                                                                              ●   1999
               ● ●●        ●●●●
                             ●●
               ● ●
                 ●●        ●
                               ●
      20         ●
                 ●
                  ●            ●
                               ●
                                                                                                              ●   2008
                  ●            ●●
                  ●
                  ●        ● ●●●●       ●        ●
                  ●
                  ●          ●                 ● ●
                                                 ●
                 ●                               ●
                               ●       ●●●
                                         ●            ●●
               ●             ●●                ●   ●  ●
               ●              ●●
                             ●●●      ● ●●●
                                         ●
                                    ● ● ●●
                                     ●
                                          ●
                                          ●    ●   ● ● ●
                                    ●●         ●   ●
                                     ●
                                    ●●         ●       ●                                         ●
                                       ●       ●          ●                     ●
               ●                    ●●                    ●
                                                      ● ● ●
                                                         ●                            ●
                                    ●                  ●           ●                            ●
      15                            ●
                                       ●
                                           ●   ●●
                                                 ● ● ● ●
                                                     ●
                                                           ●        ●                 ●                  ●
                                      ●          ●
                                                 ●
                                                    ● ●●  ● ●        ●●        ●●
                                                                               ●
                                                          ●          ●
                                                                     ●         ●
                                               ●          ● ●        ●                               ●
                                                        ● ●        ●●     ●
                                                         ●●        ●●
                                                                    ●     ●           ●
                                                                                      ●
                                                                   ●●
                                                                    ●●           ●    ●●
                                                             ●   ●   ●●          ●          ●
                                                                                 ●
                                                                                      ●
                                                                              ● ●●●
                                                                   ● ●
                                                                    ●         ● ●          ● ●
                                                                                           ●
                                                         ●                     ● ●
                                                                                ●     ●
                                               ●
      10
                                                                    ●
                                                                    ●
                                                                    ●
                                                                    ●



                       2                3                4                5                6             7
                                                        displ
●




              10


                                                    ●            ●         ●●          ●●●        ● ● ●




                                                                     ● ●       ●            ● ●       ●

               8
                                                                ●●         ●●      ●        ●     ●
1/cty * 100




                                                    ●      ● ●● ●              ●        ●●                    ●
                                                                                                                      factor(year)
                                                                                                                       ●   1999
                                         ●●       ● ●●     ●● ●            ●                      ●       ●       ●
                                                                                                                       ●   2008
                     ●                   ●●         ●       ● ● ●                       ●         ●       ●

               6                         ●● ●● ●          ● ● ●

                     ●           ●●       ● ●● ● ●          ●

                             ● ● ●●           ●     ● ●
                             ●       ●
                     ● ● ● ●●
                             ●   ●
                   ●                 ●
                   ● ●
               4   ● ●
                     ●
                   ● ●
                         ●

                         ●
                         ●



                             2                3                 4                  5                  6           7
                                                                displ
1                         2                         3                         4                         5
                               ●                         ●                         ●                         ●                         ●
              10
                           ● ● ● ● ●●
                                 ● ● ●
                                    ●                ● ● ● ● ●●
                                                           ● ● ●
                                                              ●                ● ● ● ● ●●
                                                                                     ● ● ●
                                                                                        ●                ● ● ● ● ●●
                                                                                                               ● ● ●
                                                                                                                  ●                ● ● ● ● ●●
                                                                                                                                         ● ● ●
                                                                                                                                            ●
                               ● ● ● ●
                                ●    ●                   ● ● ● ●
                                                          ●    ●                   ● ● ● ●
                                                                                    ●    ●                   ● ● ● ●
                                                                                                              ●    ●                   ● ● ● ●
                                                                                                                                        ●    ●
               8              ● ● ● ●●
                              ● ●                       ● ● ● ●●
                                                        ● ●                       ● ● ● ●●
                                                                                  ● ●                       ● ● ● ●●
                                                                                                            ● ●                       ● ● ● ●●
                                                                                                                                      ● ●
                           ● ●● ● ●
                              ●●    ●   ●            ● ●● ● ●
                                                        ●●    ●   ●            ● ●● ● ●
                                                                                  ●●    ●   ●            ● ●● ● ●
                                                                                                            ●●    ●   ●            ● ●● ● ●
                                                                                                                                      ●●    ●   ●
                        ● ●●●● ●
                         ● ● ●       ● ● ●        ● ●●●● ●
                                                   ● ● ●●
                                                       ●       ● ● ●        ● ●●●● ●
                                                                             ● ● ●●
                                                                                 ●       ● ● ●        ● ●●●● ●
                                                                                                       ● ● ●●
                                                                                                           ●       ● ● ●        ● ●●●● ●
                                                                                                                                 ● ● ●●
                                                                                                                                     ●       ● ● ●
                    ● ● ● ●●
                         ●    ●    ●● ●       ● ● ● ●●
                                                   ●    ●    ●● ●       ● ● ● ●●
                                                                             ●    ●    ●● ●       ● ● ● ●●
                                                                                                       ●    ●    ●● ●       ● ● ● ●●
                                                                                                                                 ●    ●    ●● ●
               6    ● ●●●● ●●
                       ●●● ● ●
                        ●●
                        ●●●
                     ● ● ●● ●●
                       ● ●●
                       ● ●●                   ● ●●●● ●●
                                                 ● ●●● ●
                                                  ●●●
                                               ● ● ●● ●●
                                                 ● ●●
                                                 ● ●●
                                                    ●●                  ● ●●●● ●●
                                                                           ●●● ● ●
                                                                            ●●●
                                                                            ●●●
                                                                         ● ● ●● ●●
                                                                           ● ●●
                                                                           ● ●●                   ● ●●●● ●●
                                                                                                     ● ●●● ●
                                                                                                      ●●●
                                                                                                   ● ● ●● ●●
                                                                                                     ● ●●
                                                                                                     ● ●●                   ● ●●●● ●●
                                                                                                                                ●●
                                                                                                                                ●●●● ●
                                                                                                                             ● ● ●● ●●
                                                                                                                               ● ●●
                                                                                                                               ● ●●
                     ● ● ●●
                    ● ●●
                     ● ●                       ●● ●
                                              ● ●●
                                               ● ●                       ●● ●
                                                                        ● ●●
                                                                         ● ●                       ●● ●
                                                                                                  ● ●●
                                                                                                   ● ●                       ●● ●
                                                                                                                            ● ●●
                                                                                                                             ● ●
                   ●●●
                   ● ●
                    ●                        ●●
                                               ●●
                                             ● ●                       ●●●
                                                                       ● ●
                                                                       ●●                        ●●●
                                                                                                 ● ●
                                                                                                 ●●                        ●●●
                                                                                                                           ● ●
                                                                                                                           ●●
               4   ●●
                    ●
                   ●●
                    ●
                                             ●●
                                              ●
                                             ●●
                                              ●
                                                                        ●
                                                                        ●
                                                                       ●●
                                                                        ●
                                                                                                  ●
                                                                                                  ●
                                                                                                 ●●
                                                                                                  ●
                                                                                                                            ●
                                                                                                                            ●
                                                                                                                           ●●
                                                                                                                            ●
                    ●
                    ●                         ●
                                              ●                         ●
                                                                        ●                         ●
                                                                                                  ●                         ●
                                                                                                                            ●

                              6                         7                         8                         9                       10
                               ●                         ●                         ●                         ●                         ●
              10
                           ● ● ● ● ●●
                                 ● ● ●
                                    ●                ● ● ● ● ●●
                                                           ● ● ●
                                                              ●                ● ● ● ● ●●
                                                                                     ● ● ●
                                                                                        ●                ● ● ● ● ●●
                                                                                                               ● ● ●
                                                                                                                  ●                ● ● ● ● ●●
                                                                                                                                         ● ● ●
                                                                                                                                            ●
                               ● ● ● ●
                                ●    ●                   ● ● ● ●
                                                          ●    ●                   ● ● ● ●
                                                                                    ●    ●                   ● ● ● ●
                                                                                                              ●    ●                   ● ● ● ●
                                                                                                                                        ●    ●
               8              ● ● ● ●●
                              ● ●                       ● ● ● ●●
                                                        ● ●                       ● ● ● ●●
                                                                                  ● ●                       ● ● ● ●●
                                                                                                            ● ●                       ● ● ● ●●
                                                                                                                                      ● ●
                           ● ●● ● ●
                              ●●    ●   ●            ● ●● ● ●
                                                        ●●    ●   ●            ● ●● ● ●
                                                                                  ●●    ●   ●            ● ●● ● ●
                                                                                                            ●●    ●   ●            ● ●● ● ●
                                                                                                                                      ●●    ●   ●
                        ● ●●●● ●
                         ● ● ●       ● ● ●        ● ●●●● ●
                                                   ● ● ●       ● ● ●        ● ●●●● ●
                                                                             ● ● ●       ● ● ●        ● ● ●● ●
                                                                                                       ●● ●
                                                                                                       ● ●●●       ● ● ●        ● ●●●● ●
                                                                                                                                 ● ● ●●
                                                                                                                                     ●       ● ● ●
                    ● ● ● ●●
                         ●    ●    ●● ●       ● ● ● ●●
                                                   ●    ●    ●● ●       ● ● ● ●●
                                                                             ●    ●    ●● ●       ● ● ● ●●
                                                                                                       ●    ●    ●● ●       ● ● ● ●●
                                                                                                                                 ●    ●    ●● ●
               6    ● ●●●● ●●
                       ● ●●● ●
                        ●
                     ● ● ●● ●●
                       ● ●●
                       ● ●●                   ● ●●●● ●●
                                                  ●●
                                                  ●●●● ●
                                                   ●●
                                               ● ● ●● ●●
                                                 ● ●●
                                                 ● ●●                   ● ●●●● ●●
                                                                           ●●● ● ●
                                                                            ●●●
                                                                              ●●
                                                                         ● ● ●● ●●
                                                                           ● ●●
                                                                           ● ●●
                                                                              ●●                  ● ●●●● ●●
                                                                                                     ●●● ● ●
                                                                                                      ●●●
                                                                                                   ● ● ●● ●●
                                                                                                     ● ●●
                                                                                                     ● ●●                   ● ●●●● ●●
                                                                                                                                ●●●● ●
                                                                                                                             ● ● ●● ●●
                                                                                                                               ● ●●
                                                                                                                               ● ●●
                     ●● ●
                    ● ●●
                     ● ●                       ● ● ●●
                                              ● ●●
                                               ● ●                       ●● ●
                                                                        ● ●●
                                                                         ●●●                       ●● ●
                                                                                                  ● ●●
                                                                                                   ● ●                       ● ● ●●
                                                                                                                            ● ●●
                                                                                                                             ● ●
                   ●●●
                   ● ●
                    ●                        ●●●
                                             ● ●
                                              ●                        ●● ●
                                                                       ●●                        ●●●
                                                                                                 ● ●
                                                                                                  ●                        ●●●
                                                                                                                           ● ●
                                                                                                                            ●
               4
1/cty * 100




                   ●●
                    ●                        ●●
                                              ●                        ●●
                                                                        ●                        ●●
                                                                                                  ●                        ●●
                                                                                                                            ●
                   ●●
                    ●                        ●●
                                              ●                        ●●
                                                                        ●                        ●●
                                                                                                  ●                        ●●
                                                                                                                            ●
                    ●
                    ●                         ●
                                              ●                         ●
                                                                        ●                         ●
                                                                                                  ●                         ●
                                                                                                                            ●
                                                                                                                                                     factor(year)
                            11                        12                        13                        14                        15                ●   1999
                               ●                         ●                         ●                         ●                         ●
                                                                                                                                                      ●   2008
              10
                           ● ● ● ● ●●
                                 ● ● ●
                                    ●                ● ● ● ● ●●
                                                           ● ● ●
                                                              ●                ● ● ● ● ●●
                                                                                     ● ● ●
                                                                                        ●                ● ● ● ● ●●
                                                                                                               ● ● ●
                                                                                                                  ●                ● ● ● ● ●●
                                                                                                                                         ● ● ●
                                                                                                                                            ●
                               ● ● ● ●
                                ●    ●                   ● ● ● ●
                                                          ●    ●                   ● ● ● ●
                                                                                    ●    ●                   ● ● ● ●
                                                                                                              ●    ●                   ● ● ● ●
                                                                                                                                        ●    ●
               8              ● ● ● ●●
                              ● ●                       ● ● ● ●●
                                                        ● ●                       ● ● ● ●●
                                                                                  ● ●                       ● ● ● ●●
                                                                                                            ● ●                       ● ● ● ●●
                                                                                                                                      ● ●
                           ● ●● ● ●
                              ●●    ●   ●            ● ●● ● ●
                                                        ●●    ●   ●            ● ●● ● ●
                                                                                  ●●    ●   ●            ● ●● ● ●
                                                                                                            ●●    ●   ●            ● ●● ● ●
                                                                                                                                      ●●    ●   ●
                        ● ●●●● ●
                         ● ● ●●
                             ●       ● ● ●        ● ●●●● ●
                                                   ● ● ●       ● ● ●        ● ●●●● ●
                                                                             ● ● ●       ● ● ●        ● ●●●● ●
                                                                                                       ● ● ●●
                                                                                                           ●       ● ● ●        ● ●●●● ●
                                                                                                                                 ● ● ●●
                                                                                                                                     ●       ● ● ●
                    ● ● ● ●●
                         ●    ●    ●● ●       ● ● ● ●●
                                                   ●    ●    ●● ●       ● ● ● ●●
                                                                             ●    ●    ●● ●       ● ● ● ●●
                                                                                                       ●    ●    ●● ●       ● ● ● ●●
                                                                                                                                 ●    ●    ●● ●
               6    ● ●●●● ●●
                       ● ●●● ●
                        ●●●
                     ● ● ●● ●●
                       ● ●●                   ● ●●●● ●●
                                                 ●●● ● ●
                                                  ●●
                                                  ●●●
                                               ● ● ●● ●●
                                                 ●●●●●
                                                    ●                   ● ●●●● ●●
                                                                           ●●● ● ●
                                                                            ●●●
                                                                         ● ● ●● ●●
                                                                           ● ●●                   ● ●●●● ●●
                                                                                                      ●●●
                                                                                                      ●●●● ●
                                                                                                   ● ● ●● ●●
                                                                                                     ●●●●                   ● ●●●● ●●
                                                                                                                                ●●●
                                                                                                                                ●●●● ●
                                                                                                                                 ●●
                                                                                                                             ● ● ●● ●●
                                                                                                                               ●●●●
                     ● ● ●●
                       ●
                    ● ●●
                     ●●                        ● ● ●●
                                                 ●
                                              ● ●●
                                               ●●                        ● ● ●●
                                                                           ●
                                                                        ● ●●
                                                                         ●●                        ● ● ●●
                                                                                                     ●
                                                                                                  ● ●●
                                                                                                   ●●                        ● ● ●●
                                                                                                                               ●
                                                                                                                            ● ●●
                                                                                                                             ●●
                   ●●●
                   ● ●
                    ●                        ●●●
                                             ● ●
                                              ●                        ●●●
                                                                       ● ●
                                                                        ●                        ●●●
                                                                                                 ● ●
                                                                                                  ●                        ●●●
                                                                                                                           ● ●
                                                                                                                            ●
               4   ●●
                    ●
                   ●●
                    ●
                                             ●●
                                              ●
                                             ●●
                                              ●
                                                                       ●●
                                                                        ●
                                                                       ●●
                                                                        ●
                                                                                                 ●●
                                                                                                  ●
                                                                                                 ●●
                                                                                                  ●
                                                                                                                           ●●
                                                                                                                            ●
                                                                                                                           ●●
                                                                                                                            ●
                    ●
                    ●                         ●
                                              ●                         ●
                                                                        ●                         ●
                                                                                                  ●                         ●
                                                                                                                            ●

                            16                        17                        18                        19                        20
                               ●                         ●                         ●                         ●                         ●
              10
                           ● ● ● ● ●●
                                 ● ● ●
                                    ●                ● ● ● ● ●●
                                                           ● ● ●
                                                              ●                ● ● ● ● ●●
                                                                                     ● ● ●
                                                                                        ●                ● ● ● ● ●●
                                                                                                               ● ● ●
                                                                                                                  ●                ● ● ● ● ●●
                                                                                                                                         ● ● ●
                                                                                                                                            ●
                               ● ● ● ●
                                ●    ●                   ● ● ● ●
                                                          ●    ●                   ● ● ● ●
                                                                                    ●    ●                   ● ● ● ●
                                                                                                              ●    ●                   ● ● ● ●
                                                                                                                                        ●    ●
               8              ● ● ● ●●
                              ● ●                       ● ● ● ●●
                                                        ● ●                       ● ● ● ●●
                                                                                  ● ●                       ● ● ● ●●
                                                                                                            ● ●                       ● ● ● ●●
                                                                                                                                      ● ●
                           ● ●● ● ●
                              ●●    ●   ●            ● ●● ● ●
                                                        ●●    ●   ●            ● ●● ● ●
                                                                                  ●●    ●   ●            ● ●● ● ●
                                                                                                            ●●    ●   ●            ● ●● ● ●
                                                                                                                                      ●●    ●   ●
                        ● ●●●● ●
                         ● ● ●●
                             ●       ● ● ●        ● ●●●● ●
                                                   ● ● ●●
                                                       ●       ● ● ●        ● ● ●● ●
                                                                             ●●
                                                                             ● ●●        ● ● ●        ● ●●●● ●
                                                                                                       ● ● ●       ● ● ●        ● ●●●● ●
                                                                                                                                 ● ● ●●
                                                                                                                                     ●       ● ● ●
                    ● ● ● ●●
                         ●    ●    ●● ●       ● ● ● ●●
                                                   ●    ●    ●● ●       ● ● ● ●●
                                                                             ●    ●    ●● ●       ● ● ● ●●
                                                                                                       ●    ●    ●● ●       ● ● ● ●●
                                                                                                                                 ●    ●    ●● ●
               6    ● ●●●● ●●
                        ●●
                        ●●●● ●
                     ● ● ●● ●●
                       ●●●●●
                          ●                   ● ●●●● ●●
                                                 ● ●●● ●
                                                  ●
                                               ● ● ●● ●●
                                                 ● ●●                   ● ●●●● ●●
                                                                           ●●● ● ●
                                                                            ●●●
                                                                         ● ● ●● ●●
                                                                           ●●●●●                  ● ●●●● ●●
                                                                                                     ● ●●● ●
                                                                                                      ●●
                                                                                                      ●
                                                                                                   ● ● ●● ●●
                                                                                                     ● ●●                   ● ●●●● ●●
                                                                                                                               ●●● ● ●
                                                                                                                                ●●
                                                                                                                                ●●●
                                                                                                                             ● ● ●● ●●
                                                                                                                               ● ●●
                     ● ● ●●
                       ●
                    ● ●●
                     ●●                        ● ● ●●
                                                 ●
                                              ● ●●
                                               ●●                        ● ● ●●
                                                                           ●
                                                                        ● ●●
                                                                         ●●                        ● ● ●●
                                                                                                     ●
                                                                                                  ● ●●
                                                                                                   ●●                        ● ● ●●
                                                                                                                               ●
                                                                                                                            ● ●●
                                                                                                                             ●●
                   ●●●
                   ● ●
                    ●                        ●●●
                                             ● ●
                                              ●                        ●●●
                                                                       ● ●
                                                                        ●                        ●●●
                                                                                                 ● ●
                                                                                                  ●                        ●●●
                                                                                                                           ● ●
                                                                                                                            ●
               4   ●●
                    ●
                   ●●
                    ●
                                             ●●
                                              ●
                                             ●●
                                              ●
                                                                       ●●
                                                                        ●
                                                                       ●●
                                                                        ●
                                                                                                 ●●
                                                                                                  ●
                                                                                                 ●●
                                                                                                  ●
                                                                                                                           ●●
                                                                                                                            ●
                                                                                                                           ●●
                                                                                                                            ●
                    ●
                    ●                         ●
                                              ●                         ●
                                                                        ●                         ●
                                                                                                  ●                         ●
                                                                                                                            ●

                    2 3 4 5 6 7               2 3 4 5 6 7               2 3 4 5 6 7               2 3 4 5 6 7               2 3 4 5 6 7
                                                                            displ
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference
Graphical Inference

Weitere ähnliche Inhalte

Mehr von Hadley Wickham (20)

27 development
27 development27 development
27 development
 
27 development
27 development27 development
27 development
 
24 modelling
24 modelling24 modelling
24 modelling
 
23 data-structures
23 data-structures23 data-structures
23 data-structures
 
R packages
R packagesR packages
R packages
 
22 spam
22 spam22 spam
22 spam
 
21 spam
21 spam21 spam
21 spam
 
20 date-times
20 date-times20 date-times
20 date-times
 
19 tables
19 tables19 tables
19 tables
 
18 cleaning
18 cleaning18 cleaning
18 cleaning
 
17 polishing
17 polishing17 polishing
17 polishing
 
16 critique
16 critique16 critique
16 critique
 
15 time-space
15 time-space15 time-space
15 time-space
 
14 case-study
14 case-study14 case-study
14 case-study
 
13 case-study
13 case-study13 case-study
13 case-study
 
12 adv-manip
12 adv-manip12 adv-manip
12 adv-manip
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
 
10 simulation
10 simulation10 simulation
10 simulation
 
10 simulation
10 simulation10 simulation
10 simulation
 

Kürzlich hochgeladen

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Kürzlich hochgeladen (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

Graphical Inference

  • 1. A graphical grammar + graphical inference = a grammar of graphical inference? Hadley Wickham, Rice University
  • 2. 1. Motivation 2. Resampling methods (graphical inference) 3. Graphical display (grammar of graphics) 4. Future work
  • 3. 5 8 6 ● ● ● 4 ● ● ● ● ● ● ● ● ● ● ● ● ● ●● 2 ● species ● ● ● ● Concinna ● ● ● ● ● Heikert. ● 0 ● ● ● ● ● ● ● ● Heptapot. ● ● ●● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●● −2 ● ● ● ● ● ● ● ● ● ● ● ● ● −4 −6 −6 −4 −2 0 2 4 6
  • 4. 1 2 3 4 8 6 4 ● ●● ● ● 2 ●● ●●● ● ●● ● ●● ● ● ● ● ●●● ●● ● ●● ● ● ● ● ● ● ● ● ●●●●● ● ● ● ●● ●●● ●● ● ● ● ● ●● ● ●●● ●● ● ● ● ● ● ● ●● ● ● ● ● ●●●● ●● ● ● ●● ● ●●● ● ● ● ● ●● ●●● ●●●●● ● ●●● ●● ●●● ● ●●●● ● ● ●●●● ● ● 0 ● ● ● ●● ● ●● ● ●● ●● ●●● ● ●● ● ●● ● ● ●● ●● ●● ●● ● ●● ● ● ● ●● ● ● ● ● ● ● ●● ● ● ●●● ● ●● ●● ●● ● ●● ●● ●● ● ●● ● ●● ●● ●● ●● ● ● ● ● ●● ●●● ● ● ● ● ●● ●● ● ● ●●●●● ● ●● ●●● ● ●● ● ● −2 ●● ● ● ● ● −4 −6 5 6 7 8 8 6 4 ●● ● ● ● species ●●● ●● ● ●● ● ● ● ● ● 2 ●● ● ● ● ●● ● ● ●● ● ● ● ● ●● ●● ● Concinna ● ● ● ● ● ● ●● ●● ● ● ● ●● ●● ● ● ● ● ●● ●●●● ● ● ● ● ●● ● ●● ● ●● ● ● ●● ● ●● 0 ●● ●● ● ● ● ● ●●●● ● ●●● ●●● ● ●●●●● ●●●● ● ● ●● ●● ● ●● ● ● ● ●● ● ● ●● ● ●● ● ●●●● ●● ● ●● ●● ●● ● ● ● ●● ● ● ●●● ●● ● ● ●●●●● ● ● Heikert. ● ● ● ● ●● ● ●● ● ● ●● ● ●● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ●●●● ● ●●●● ● ●●● ●● ●● ● ● ●●●●● ● ● ● ● ● ● ● ● ●●● ● ● ● ●● ● ● ●●● ● ●● ● −2 ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ●● ● Heptapot. −4 −6 9 10 11 12 8 6 4 ● ● 2 ●● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ●●●●● ● ● ●●● ● ●● ● ● ●●● ● ● ● ● ●● ●●● ● ● ● ●● ●● ● ● ● ● ● ●●●● ●● ●●● ● ● ● ● ● ● ●●●● ● ●● ●● ● ●●●●● ●● ● ●● ●●●● ●●●● ●●●●● ● ● ●● ● ●● ● 0 ●●● ●● ● ● ● ●● ●● ● ● ●● ● ● ●●●●● ● ●●●●● ● ● ●● ● ● ● ●●●● ● ● ● ● ●● ●● ● ● ● ●●●● ●● ●● ● ●● ●● ●● ●● ● ● ● ●● ● ●● ● ●●● ●● ●● ● ● ● ● ●●●● ● ● ● ● ●● ● ● ● ●●●● ● ●●● ●● ● ●●●● ● ● ●● ●●● ● ●●● ●● ●●● ● ●● ● ● ●● −2 ● ● ● −4 −6 −6 −4 −2 0 2 4 6 −6 −4 −2 0 2 4 6 −6 −4 −2 0 2 4 6 −6 −4 −2 0 2 4 6
  • 5. 1 2 3 4 ● 4 ● ● ● ● ● ●● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● 2 ● ● ● ● ● ● ● ●● ● ● ● ● ●● ●● ● ● ●●● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ● ●●● ● ● ● ●● ● ● ● ●● ● ●● ● ●● ● ● ● ●● ●● ● ● ● ● ●● ● ● ● ●● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ●●●● ●●●● ● ●● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ●● ● ● ● ● ● ●● ● ● ● ● ●● ● ●● ● ● ● ●● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ●● ● ●● ● ●● ●●●● ●● ●● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●●● ● −2 ● ●● ● ●● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● −4 5 6 7 8 ● 4 ● ● ● ● ● ● ● ● ●● ● ● ● species ● ● ● ● ● ● ●● ● 2 ● ●● ● ●● ●● ●● ● ● ● ●● ● ● ●● ● ● ●● ● ● ● ● ●●● ●●● ● ●● ● ● ● ●● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ● ●● ● ●● ● ● ●● ● ● ●● ● ● ● Concinna ● ●● ● ● ●● ● ● ● ● ●●● ●●● ● ● ● ● ●● ● ● ●● 0 ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ●● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ●● ● ●● ● ● ●● ● ● ●● ●●● ●● ● ● ●● ● ● ● ● ● ● ● Heikert. ●● ● ●● ● ● ● ● ●● ● ● ● ●● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ●● ● ● ● ● ●●● ● ● ● ● ●● ●● ● ● ● ● −2 ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● Heptapot. ● ● ● ● ● ● −4 9 10 11 12 4 ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ● ● ● 2 ●● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ●●● ● ● ●● ● ● ● ●● ● ● ●● ● ●● ● ● ●● ●● ● ● ●● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ●●● ● ● ● ● ● ●●● ● ●● ● ● ● ● ● ● ● ●● ● ● ● ● 0 ●● ●● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ●● ●● ●●●●●● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ●● ●● ● ● ●● ● ● ● ● ●●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ●● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ●● −2 ● ● ● ● ● ● ● ● ●● ●● ●● ● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● −4 −4 −2 0 2 4 −4 −2 0 2 4 −4 −2 0 2 4 −4 −2 0 2 4
  • 6. Problem Want to make it very easy to make these types of display - should be able to create as easy as doing as simple numerical test. With the right tools, it turns out to be really easy! Two basic problems: how to do resampling under the null, and how to define the graphic.
  • 7. Resampling Many resampling methods have particularly elegant expression in R code. For example, if null hypothesis is that of independence: df <- transform(df, resp = sample(resp)) However, better to generalise the pattern.
  • 8. Generalisation permute_var <- function(var) { function(df) { df[[var]] <- sample(df[[var]]) df } } f <- permute_var(quot;mpgquot;) f(mtcars) permute_var(quot;mpgquot;)(mtcars)
  • 9. Advantages Separate description from implementation. Call describes action. Can later replace implementation if better approach discovered. Unimportant details concealed.
  • 10. n resamples Each method gives us a single resample, but we need n. Trivial to repeat n times with rdply() from the plyr package. (rdply() is a generalisation of replicate() that returns a data frame with a column that labels each replicate.)
  • 11. Overall resamp <- function(true, method, n = 19, pos = sample(n + 1, 1)) { samples <- rdply(n, method(true)) if (missing(pos)) { message(quot;True data in position quot;, pos) } add_true(samples, true, pos) } add_true <- function(samples, true, n) { samples$.n <- with(samples, ifelse(.n >= n, .n + 1, .n)) true$.n <- n all <- rbind(samples, true) all[order(all$.n), ] } Will see application shortly
  • 12. Other nulls Need functions for other common null hypotheses. Experimental null_model(), which computes rotation residuals given a specified linear model. (Demo a little later)
  • 13. Display How is the plot of the simulated data with true data different from a single plot? Just need to repeat the same display n times and label appropriately. This is easy if we have a description of the plot, independent of the data.
  • 14. Grammar of Graphics This is one principle of the grammar of graphics: should describe the graphic we want, not how to create it. Implemented with the ggplot2 package in R. Easy to modify a graphic after it has been created. For graphical inference, we need to change the data and facetting.
  • 16. 35 ● 30 ● ● ● ● ● ● 25 ● ● ● ● ● ● ● ● ● factor(year) ●● ● cty ● ● ● ● ● ●● ● ● 1999 ● ●● ●●●● ●● ● ● ●● ● ● 20 ● ● ● ● ● ● 2008 ● ●● ● ● ● ●●●● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ●● ● ●● ● ● ● ● ●● ●●● ● ●●● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● 15 ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ●● ● ● ● ● ●● ●● ● ●● ● ● ●● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 10 ● ● ● ● 2 3 4 5 6 7 displ
  • 17. 10 ● ● ●● ●●● ● ● ● ● ● ● ● ● ● 8 ●● ●● ● ● ● 1/cty * 100 ● ● ●● ● ● ●● ● factor(year) ● 1999 ●● ● ●● ●● ● ● ● ● ● ● 2008 ● ●● ● ● ● ● ● ● ● 6 ●● ●● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● 4 ● ● ● ● ● ● ● ● 2 3 4 5 6 7 displ
  • 18. 1 2 3 4 5 ● ● ● ● ● 10 ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 8 ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● 6 ● ●●●● ●● ●●● ● ● ●● ●●● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ● ●●● ● ●●● ● ● ●● ●● ● ●● ● ●● ●● ● ●●●● ●● ●●● ● ● ●●● ●●● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ● ●●● ● ●●● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ●● ●●●● ● ● ● ●● ●● ● ●● ● ●● ● ● ●● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●● ● ● ●●● ● ● ● ●● ●● ● ● ●●● ● ● ●● ●●● ● ● ●● ●●● ● ● ●● 4 ●● ● ●● ● ●● ● ●● ● ● ● ●● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● 6 7 8 9 10 ● ● ● ● ● 10 ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 8 ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ●●● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● 6 ● ●●●● ●● ● ●●● ● ● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ●● ●●●● ● ●● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ●●● ● ● ●●● ●● ● ● ●● ●● ● ●● ● ●● ●● ● ●●●● ●● ●●● ● ● ●●● ● ● ●● ●● ● ●● ● ●● ● ●●●● ●● ●●●● ● ● ● ●● ●● ● ●● ● ●● ●● ● ● ●● ● ● ● ● ●● ● ●● ● ● ●● ● ● ●● ●●● ●● ● ● ●● ● ● ● ● ●● ● ●● ● ● ●●● ● ● ● ●●● ● ● ● ●● ● ●● ●●● ● ● ● ●●● ● ● ● 4 1/cty * 100 ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● factor(year) 11 12 13 14 15 ● 1999 ● ● ● ● ● ● 2008 10 ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 8 ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● 6 ● ●●●● ●● ● ●●● ● ●●● ● ● ●● ●● ● ●● ● ●●●● ●● ●●● ● ● ●● ●●● ● ● ●● ●● ●●●●● ● ● ●●●● ●● ●●● ● ● ●●● ● ● ●● ●● ● ●● ● ●●●● ●● ●●● ●●●● ● ● ● ●● ●● ●●●● ● ●●●● ●● ●●● ●●●● ● ●● ● ● ●● ●● ●●●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● 4 ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● 16 17 18 19 20 ● ● ● ● ● 10 ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 8 ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ● ●● ● ●● ● ●● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ● ● ●● ● 6 ● ●●●● ●● ●● ●●●● ● ● ● ●● ●● ●●●●● ● ● ●●●● ●● ● ●●● ● ● ● ● ●● ●● ● ●● ● ●●●● ●● ●●● ● ● ●●● ● ● ●● ●● ●●●●● ● ●●●● ●● ● ●●● ● ●● ● ● ● ●● ●● ● ●● ● ●●●● ●● ●●● ● ● ●● ●●● ● ● ●● ●● ● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ●● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● ●●● ● ● ● 4 ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● 2 3 4 5 6 7 2 3 4 5 6 7 2 3 4 5 6 7 2 3 4 5 6 7 2 3 4 5 6 7 displ