

coplot {base}                                R Documentation

_C_o_n_d_i_t_i_o_n_i_n_g _P_l_o_t_s

_D_e_s_c_r_i_p_t_i_o_n_:

     This function produces two variants of the conditioning
     plots discussed in the reference below.

_U_s_a_g_e_:

     coplot(formula, data, given.values, panel = points, rows, columns,
            show.given = TRUE, col = par("fg"), pch = par("pch"),
            xlab = paste("Given :", a.name),
            ylab = paste("Given :", b.name),
            number = 6, overlap = 0.5, ...)
     co.intervals(x, number = 6, overlap = 0.5)

_A_r_g_u_m_e_n_t_s_:

 formula: a formula describing the form of conditioning
          plot.  A formula of the form `y ~ x | a' indicates
          that plots of `y' versus `x' should be produced
          conditional on the variable `a'.  A formula of the
          form `y ~ x| a * b' indicates that plots of `y'
          versus `x' should be produced conditional on the
          two variables `a' and `b'.

          `x' and `y' must be numeric, but `a' and `b' may
          be either numeric or factors.

    data: a data frame containing values for any variables
          in the formula.  By default the environment where
          `coplot' was called from is used.

given.values: a value or list of two values which determine
          how the conditioning on `a' and `b' is to take
          place.

          When there is no `b' (i.e., conditioning only on
          `a'), usually this is a matrix with two columns
          each row of which gives an interval, to be condi-
          tioned on, but is can also be a single vector of
          numbers or a set of factor levels (if the variable
          being conditioned on is a factor). In this case
          (no `b'), the result of `co.intervals(..)' can be
          used directly as `given.values' argument.

   panel: a `function(x,y, col, pch, ...)'  which gives the
          action to be carried out in each panel of the dis-
          play.  The default is `points'.

    rows: the panels of the plot are laid out in a `rows' by
          `columns' array.  `rows' gives the number of rows
          in the array.

 columns: the number of columns in the panel layout array.

show.given: logical (possibly of length 2 for 2 conditioning
          variables): should conditioning plots be shown for
          the corresponding conditioning variables (default
          `TRUE')

     col: a vector of colors to be used to plot the points.
          If too short, the values are recycled.

     pch: a vector of plotting symbols or characters.  If
          too short, the values are recycled.

    xlab: character; label to use for the 1st conditioning
          variable.

    ylab: character; label to use for the 2nd conditioning
          variable.

  number: integer; the number of conditioning intervals,
          possibly of length 2 for x and y direction.

 overlap: numeric < 1; the fraction of overlap of the condi-
          tioning variables, possibly of length 2 for x and
          y direction.  When overlap < 0, there will be gaps
          between the data slices.

     ...: additional arguments to the panel function.

_V_a_l_u_e_:

     `co.intervals(., number, .)' returns a (`number' x 2)
     `matrix', say `ci',  where `ci[k,]' is the `range' of
     `x' values for the `k'-th interval.

_R_e_f_e_r_e_n_c_e_s_:

     Cleveland, W. S. (1993).  Visualizing Data.  New Jer-
     sey: Summit Press.

_S_e_e _A_l_s_o_:

     `pairs', `panel.smooth', `points'.

_E_x_a_m_p_l_e_s_:

     ## Tonga Trench Earthquakes
     data(quakes)
     coplot(long ~ lat | depth, data = quakes)
     given.depth <- co.intervals(quakes$depth, number=4, overlap=.1)
     coplot(long ~ lat | depth, data = quakes, given.values=given.depth)

     ## Conditioning on 2 variables:
     ll.dm <- long ~ lat | depth * mag
     coplot(ll.dm, data = quakes)
     coplot(ll.dm, data = quakes, number=c(4,7), show.given = c(T,F))
     coplot(ll.dm, data = quakes, number=c(3,7),
            overlap=c(-.5,.1)) # negative overlap DROPS values

     data(warpbreaks)
     ## given two factors
     coplot(breaks ~ 1:54 | wool * tension, data = warpbreaks, col = 'red')

     ## Example with empty panels:
     data(state)
     attach(data.frame(state.x77))#> don't need `data' arg. below
     coplot(Life.Exp ~ Income | Illiteracy * state.region, number = 3,
            panel=function(x,y,...) panel.smooth(x,y, span= .8, ...))

