
Last chance! 50% off unlimited learning
Sale ends in
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.
contourPlot(
x,
y,
m = 30L,
xrange,
yrange,
xkernel,
ykernel,
nlevels = 9L,
densityColors = heat.colors(nlevels),
pointColors = "gray",
...
)
numeric vector of the x
data to be plotted
numeric vector of the y
data to be plotted
integer value of the number of x
and y
grid points
numeric vector of length two indicating x
-range of plot;
defaults to range(x)
numeric vector of length two indicating y
-range of plot;
defaults to range(y)
numeric indicating the standard deviation of Normal
x
kernel to use in generating contour plot
numeric indicating the standard deviation of Normal
y
kernel to use in generating contour plot
integer with the number of levels of the contour plot
colors to use, specified as in par
.
Defaults to the heat.colors
with nlevels
. When specified, colors
overrides nlevels
.
color for the plot points
additional arguments to be passed to a plot call that generates the scatter plot and the contour plot
# 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)
# }
Run the code above in your browser using DataLab