Learn R Programming

alr3 (version 1.0.3)

mmps: Marginal model plot

Description

For a regression object, plots the response on the vertical axis versus a linear combination $u$ of terms in the mean function on the horizontal axis. Added to the plot are a loess smooth for the graph, along with a loess smooth from the plot of the fitted values on $u$.

Usage

mmps(object,exclude=NULL,layout=NULL,ask,...)

mmp.lm(object, u = predict(object), mean = TRUE, sd = FALSE, 
   label = deparse(substitute(u)), degree = 1, span = 2/3, 
   colors = c("blue", "red"), ...)

Arguments

object
A regression object, of type either lm or glm, for which there is a predict method defined.
exclude
A vector of indices of variables for which a plot is not required. For example, c(2,4) would exclude the second and fourth terms in the model, excluding the intercept.
layout
A reasonable layout for the plots in the window is determined by the program. If you don't like the default you can set your own layout: c(2,3) means two rows and three columns.
ask
If TRUE, ask before clearing the graph window to draw more plots.
u
The quantity to be plotted on the horizontal axis. The default is the predicted values predict(object). Can be any other vector of length equal to the number of observations in the object.
mean
If TRUE, compare mean smooths
sd
If TRUE, compare sd smooths
label
label for horizontal axis
degree
Degree of the local polynomial, passed to loess. The usual default for loess is 2, but the default here is one.
span
Span, the smoothing parameter for loess.
colors
colors for data and model smooth, respectively
...
additional arguments passed to loess and plot

Value

  • Used for its side effect of producing plots.

Details

mmp draws one marginal model plot. mmps draws all marginal model plots, versus each of the terms in the model and versus fitted values. mmps should not be used if some of the terms in the model are factors or interactions.

References

S. Weisberg (2005), Applied Linear Regression, third edition, Wiley, Chapter 8

See Also

loess, plot

Examples

Run this code
data(ufcwc)
c1 <- lm(Height~Dbh,ufcwc)
mmp(c1,ufcwc$Dbh,label="Diameter, Dbh",color=c("black","black"))
mmps(c1)

Run the code above in your browser using DataLab