Rev 6994 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{coplot}\title{Conditioning Plots}\usage{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, \dots)co.intervals(x, number = 6, overlap = 0.5)}\alias{coplot}\alias{co.intervals}\arguments{\item{formula}{a formula describing the form of conditioning plot. Aformula of the form \code{y ~ x | a} indicates that plots of\code{y} versus \code{x} should be produced conditional on thevariable \code{a}. A formula of the form \code{y ~ x| a * b}indicates that plots of \code{y} versus \code{x} should be producedconditional on the two variables \code{a} and \code{b}.\code{x} and \code{y} must be numeric, but \code{a} and \code{b} maybe either numeric or factors.}\item{data}{a data frame containing values for any variables in theformula. By default the environment where \code{coplot} was calledfrom is used.}\item{given.values}{a value or list of two values which determine howthe conditioning on \code{a} and \code{b} is to take place.When there is no \code{b} (i.e., conditioning only on \code{a}),usually this is a matrix with two columns each row of which gives aninterval, to be conditioned on, but is can also be a single vectorof numbers or a set of factor levels (if the variable beingconditioned on is a factor). In this case (no \code{b}),the result of \code{co.intervals(..)} can be used directly as\code{given.values} argument.}\item{panel}{a \code{\link{function}(x,y, col, pch, \dots)}which gives the action to be carried out ineach panel of the display. The default is \code{points}.}\item{rows}{the panels of the plot are laid out in a \code{rows} by\code{columns} array. \code{rows} gives the number of rows in thearray.}\item{columns}{the number of columns in the panel layout array.}\item{show.given}{logical (possibly of length 2 for 2 conditioningvariables): should conditioning plots be shown for thecorresponding conditioning variables (default \code{TRUE})}.\item{col}{a vector of colors to be used to plot the points. If tooshort, the values are recycled.}\item{pch}{a vector of plotting symbols or characters. If too short,the values are recycled.}\item{xlab}{character; label to use for the 1st conditioning variable.}\item{ylab}{character; label to use for the 2nd conditioning variable.}\item{number}{integer; the number of conditioning intervals,possibly of length 2 for x and y direction.}\item{overlap}{numeric < 1; the fraction of overlap of theconditioning variables, possibly of length 2 for x and ydirection. When overlap < 0, there will be \emph{gaps} betweenthe data slices.}\item{\dots}{additional arguments to the panel function.}}\description{This function produces two variants of the conditioning plotsdiscussed in the reference below.}\value{\code{co.intervals(., number, .)} returns a (\code{number} \eqn{\times}{x}2) \code{\link{matrix}}, say \code{ci}, where \code{ci[k,]} isthe \code{\link{range}} of \code{x} values for the \code{k}-th interval.}\references{Cleveland, W. S. (1993).\emph{Visualizing Data}.New Jersey: Summit Press.}\seealso{\code{\link{pairs}},\code{\link{panel.smooth}},\code{\link{points}}.}\examples{## Tonga Trench Earthquakesdata(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 * magcoplot(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 valuesdata(warpbreaks)## given two factorscoplot(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. belowcoplot(Life.Exp ~ Income | Illiteracy * state.region, number = 3,panel=function(x,y,...) panel.smooth(x,y, span= .8, ...))}\keyword{hplot}\keyword{aplot}