mmps {car} | R Documentation |
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. mmps
is an alias
for marginalModelPlots
, and mmp
is an alias for marginalModelPlot
.
marginalModelPlots(...) mmps(model, terms= ~ ., fitted=TRUE, layout=NULL, ask, main, ...) marginalModelPlot(...) ## S3 method for class 'lm' mmp(model, variable, mean = TRUE, sd = FALSE, xlab = deparse(substitute(variable)), degree = 1, span = 2/3, key=TRUE, ...) ## Default S3 method: mmp(model, variable, mean = TRUE, sd = FALSE, xlab = deparse(substitute(variable)), degree = 1, span = 2/3, key = TRUE, col.line = palette()[c(4,2)], col=palette()[1], labels, id.method = "y", id.n=if(id.method[1]=="identify") Inf else 0, id.cex = 1, id.col=palette()[1], grid=TRUE, ...) ## S3 method for class 'glm' mmp(model, variable, mean = TRUE, sd = FALSE, xlab = deparse(substitute(variable)), degree = 1, span = 2/3, key=TRUE, col.line = palette()[c(4, 2)], col=palette()[1], labels, id.method="y", id.n=if(id.method[1]=="identify") Inf else 0, id.cex=1, id.col=palette()[1], grid=TRUE, ...)
model |
A regression object, usually of class either |
terms |
A one-sided formula. A marginal model plot will be drawn for
each variable on the right-side of this formula that is not a factor. The
default is |
fitted |
If the default |
layout |
If set to a value like |
ask |
If |
main |
Main title for the array of plots. Use |
... |
Additional arguments passed from |
variable |
The quantity to be plotted on the horizontal axis. The
default is the predicted values |
mean |
If |
sd |
If |
xlab |
label for horizontal axis |
degree |
Degree of the local polynomial, passed to |
span |
Span, the smoothing parameter for |
key |
If |
id.method,labels,id.n,id.cex,id.col |
Arguments for labelling
points. The default |
col.line |
colors for data and model smooth, respectively. Using the default palette, these are blue and red. |
col |
color(s) for the plotted points. |
grid |
If TRUE, the default, a light-gray background grid is put on the graph |
mmp
and marginalModelPlot
draw one marginal model plot against
whatever is specified as the horizontal axis.
mmps
and marginalModelPlots
draws marginal model plots
versus each of the terms in the terms
argument and versus fitted values.
mmps
skips factors and interactions if they are specified in the
terms
argument. Terms based on polynomials or on splines (or
potentially any term that is represented by a matrix of predictors) will
be used to form a marginal model plot by returning a linear combination of the
terms. For example, if you specify terms ~ X1 + poly(X2, 3)
and
poly(X2, 3)
was part of the original model formula, the horizontal
axis of the marginal model plot will be the value of
predict(model, type="terms")[, "poly(X2, 3)"])
. If the predict
method for the model you are using doesn't support type="terms"
,
then the polynomial/spline term is skipped.
Used for its side effect of producing plots.
Sanford Weisberg, sandy@stat.umn.edu
Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition. Sage.
Weisberg, S. (2005) Applied Linear Regression, Third Edition, Wiley, Chapter 8.
## Not run: c1 <- lm(infant.mortality ~ gdp, UN) mmps(c1) c2 <- update(c1, ~ poly(gdp, 4), data=na.omit(UN)) # plot against predict(c2, type="terms")[, "poly(gdp, 4)"] and # and against gdp mmps(c2, ~ poly(gdp,4) + gdp) # include SD lines p1 <- lm(prestige ~ income + education, Prestige) mmps(p1, sd=TRUE) # logisitic regression example # smoothers return warning messages. m1 <- glm(lfp ~ ., family=binomial, data=Mroz) mmps(m1) ## End(Not run)