summary
, print
, plot
, and [
methods for eff
, effpoly
,
and efflist
objects.## S3 method for class 'eff':
print(x, type=c("response", "link"), ...)
## S3 method for class 'effpoly':
print(x, type=c("probability", "logits"), ...)
## S3 method for class 'efflatent':
print(x, ...)
## S3 method for class 'efflist':
print(x, ...)
## S3 method for class 'summary.eff':
print(x, ...)
## S3 method for class 'eff':
summary(object, type=c("response", "link"), ...)
## S3 method for class 'effpoly':
summary(object, type=c("probability", "logits"), ...)
## S3 method for class 'efflatent':
summary(object, ...)
## S3 method for class 'efflist':
summary(object, ...)
## S3 method for class 'eff':
plot(x, x.var = which.max(levels), z.var = which.min(levels),
multiline = is.null(x$se), rug = TRUE, xlab, ylab, main = paste(effect,
"effect plot"), colors = palette(), symbols = 1:10, lines = 1:10,
cex = 1.5, ylim, factor.names = TRUE, type = c("response",
"link"), ticks = list(at = NULL, n = 5), alternating = TRUE,
rotx = 0, roty = 0, grid = FALSE, layout, rescale.axis = TRUE,
key.args = NULL, row = 1, col = 1, nrow = 1, ncol = 1, more = FALSE,
...)
## S3 method for class 'effpoly':
plot(x, type = c("probability", "logit"), x.var = which.max(levels),
rug = TRUE, xlab, ylab = paste(x$response, " (", type, ")",
sep = ""), main = paste(effect, "effect plot"), colors,
symbols = 1:10, lines = 1:10, cex = 1.5, factor.names = TRUE,
style = c("lines", "stacked"), confint = (style == "lines" &&
!is.null(x$confidence.level)), ylim, rotx = 0, alternating = TRUE,
roty = 0, grid = FALSE, layout, key.args = NULL, row = 1,
col = 1, nrow = 1, ncol = 1, more = FALSE, ...)
## S3 method for class 'efflist':
plot(x, selection, rows, cols, ask=FALSE, graphics=TRUE, ...)
## S3 method for class 'efflist':
[(x, ...)
"eff"
, "effpoly"
, "efflist"
,
or "summary.eff"
, as appropriate."eff"
, "effpoly"
, or "efflist"
,
as appropriate."response"
(the default), effects are printed
or the vertical axis is labelled on the scale of the response
variable; if "link"
, effects are printed
or the verticTRUE
, each panel of the display represents combinations
of values of two predictors, with one predictor (corresponding to x.var
)
on the horzontal axis, and the otheTRUE
,
in which case separate panels are used for different response levels.TRUE
, the default, a rug plot is shown giving the marginal
distribution of the predictor on the horizontal axis, if this predictor is
a covariate.colors[1]
is used to plot effects, colors[2]
to plot
confidence bands. In a mulitline plot, the successive colors
correspond
to the levels of the z.var
covariate or factor. In a stacked plot oz.var
covariate
or factor on a multiline plot, or to the successive levels of the response factor
in a line plot for a polytomous logit model.
These arguments are used only if multiline
1.5
.NULL
, the default, then the vertical axes are scaled from the data.TRUE
, that controls the inclusion of
factor names in conditioning-variable labels."lines"
(the default
for a line plot, or "stacked"
for a stacked-bar or stacked-area plot. In the latter
case only fitted probabilities may be plotted and confidence eat
and n
. If at=NULL
(the default), the program
attempts to find `nice' locations for the ticks, and the value of TRUE
(the default), the tick labels alternate by panels in
multi-panel displays from left to right and top to bottom; if FALSE
, tick labels
appear at the bottom and on the left.TRUE
, add grid lines to the plot. Default is FALSE.layout
argument to the xyplot
(or, in some cases densityplot
), which
is used to draw the effect displTRUE
(the default), the tick marks on the vertical axis
are labelled on the response scale (e.g., the probability scale for effects computed on
the logit scale for a binomial GLM).key
trellis argument to
xyplot
or densityplot
,
e.g., to position the key (legend) in therow
, col
, nrow
, and ncol
are used to compose
the split
argument and more
the more
efflist
object;
if either argument is missing, then the meta-layout will be computed by the plot
method.selection
is not supplied and ask
is TRUE
,
a menu of high-order terms is presented; if ask
is FALSE
(the default), effects for all
high-order terms are plotted in an array.TRUE
(the default), then the menu of terms to plot is presented
in a dialog box rather than as a text menu.summary
method for "eff"
objects returns a "summary.eff"
object with the following components
(those pertaining to confidence limits need not be present):[
method for "efflist"
objects is used to subset an "efflist"
object and returns an object of the same class.print
and summary
methods for
eff
objects print the computed effects on the scale of the
response variable using the inverse of the
link function. In a logit model, for example, this means that the effects are expressed on the probability
scale.
By default, effects in a GLM are plotted on the scale of the linear predictor, but the vertical
axis is labelled on the response scale. This preserves the linear structure of the model while permitting
interpretation on what is usually a more familiar scale.
This approach may also be used with linear models, for example to display effects on the scale of the
response even if the data are analyzed on a transformed scale, such as log or square-root.
In a polytomous (multinomial or proportional-odds) logit model, by default effects are plotted on the
probability scale; they may be alternatively plotted on the scale of the individual-level logits.effect
, allEffects
, xyplot
,
densityplot
, print.trellis
rainbow_hcl
, sequential_hcl
mod.cowles <- glm(volunteer ~ sex + neuroticism*extraversion,
data=Cowles, family=binomial)
eff.cowles <- allEffects(mod.cowles, xlevels=list(neuroticism=0:24,
extraversion=seq(0, 24, 6)))
eff.cowles
plot(eff.cowles, 'sex', ylab="Prob(Volunteer)", grid=TRUE, rotx=90)
plot(eff.cowles, 'neuroticism:extraversion', ylab="Prob(Volunteer)",
ticks=list(at=c(.1,.25,.5,.75,.9)))
plot(eff.cowles, 'neuroticism:extraversion', multiline=TRUE,
ylab="Prob(Volunteer)", key.args = list(x = 0.75, y = 0.75, corner = c(0, 0)))
plot(effect('sex:neuroticism:extraversion', mod.cowles,
xlevels=list(neuroticism=0:24, extraversion=seq(0, 24, 6))), multiline=TRUE)
mod.beps <- multinom(vote ~ age + gender + economic.cond.national +
economic.cond.household + Blair + Hague + Kennedy +
Europe*political.knowledge, data=BEPS)
plot(effect("Europe*political.knowledge", mod.beps,
xlevels=list(Europe=1:11, political.knowledge=0:3)))
plot(effect("Europe*political.knowledge", mod.beps,
xlevels=list(Europe=1:11, political.knowledge=0:3),
given.values=c(gendermale=0.5)),
style="stacked", colors=c("blue", "red", "orange"), rug=FALSE)
mod.wvs <- polr(poverty ~ gender + religion + degree + country*poly(age,3),
data=WVS)
plot(effect("country*poly(age, 3)", mod.wvs))
plot(effect("country*poly(age, 3)", mod.wvs), style="stacked",
colors=c("gray75", "gray50", "gray25"))
plot(effect("country*poly(age, 3)", latent=TRUE, mod.wvs))
mod.pres <- lm(prestige ~ log(income, 10) + poly(education, 3) + poly(women, 2),
data=Prestige)
eff.pres <- allEffects(mod.pres, default.levels=50)
plot(eff.pres)
plot(eff.pres[1:2])
Run the code above in your browser using DataLab