SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
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

Contenu connexe

Plus de 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
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Dernier (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

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