contourPlot: Overlaid Scatter and Contour Plots

Description Usage Arguments Author(s) Examples

Description

Diagnostic plots for regressions can become too dense to interpret. This function helps by adding a contour plot over the points to allow the density of points to be seen, even when an area is entirely covered in points.

Usage

1
2
contourPlot(x, y, m = 30L, xrange, yrange, xkernel, ykernel,
  nlevels = 9L, ...)

Arguments

x

numeric vector of the x data to be plotted

y

numeric vector of the y data to be plotted

m

integer value of the number of x and y grid points

xrange

numeric vector of length two indicating x-range of plot; defaults to range(x)

yrange

numeric vector of length two indicating y-range of plot. defaults to range(y)

xkernel

numeric indicating the standard deviation of Normal x kernel to use in generating contour plot

ykernel

numeric indicating the standard deviation of Normal y kernel to use in generating contour plot

nlevels

integer with the number of levels of the contour plot

...

additional arguments to be passed to a plot call that generates the scatter plot and the contour plot

Author(s)

Yuqi Liao and Paul Bailey

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
sdf <- readNAEP(system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
lm1 <- lm.sdf(composite ~ pared * dsex + sdracem, sdf)
# plot the results
contourPlot(x=lm1$fitted.values,
	          y=lm1$residuals[,1], # use only the first plausible value
	          m=30,
	          xlab="fitted values",
	          ylab="residuals",
	          main="Figure 1")
# add a line indicating where the residual is zero
abline(0,0)

## End(Not run)

Example output

Loading required package: car
Loading required package: carData
Loading required package: lfactors
lfactors v1.0.4

EdSurvey v2.3.2


Attaching package: 'EdSurvey'

The following objects are masked from 'package:base':

    cbind, rbind

EdSurvey documentation built on May 2, 2019, 7:30 a.m.