plot.nestedLogit {nestedLogit} | R Documentation |
Plotting Nested Logit Models
Description
A plot
method for "nestedLogit"
objects produced by the
nestedLogit
function. Fitted probabilities under the model are plotted
for each level of the polytomous response variable, with one of the explanatory variables
on the horizontal axis and other explanatory variables fixed to particular values.
By default, a 95% pointwise confidence envelope is added to the plot.
Usage
## S3 method for class 'nestedLogit'
plot(
x,
x.var,
others,
n.x.values = 100L,
xlab = x.var,
ylab = "Fitted Probability",
main,
cex.main = 1,
digits.main = getOption("digits") - 2L,
font.main = 1L,
pch = 1L:length(response.levels),
lwd = 3,
lty = 1L:length(response.levels),
col = palette()[1L:length(response.levels)],
legend = TRUE,
legend.inset = 0.01,
legend.location = "topleft",
legend.bty = "n",
conf.level = 0.95,
conf.alpha = 0.3,
...
)
Arguments
x |
an object of |
x.var |
quoted name of the variable to appear on the x-axis; if omitted, the first predictor in the model is used. |
others |
a named list of values for the other variables in the model,
that is, other than |
n.x.values |
the number of evenly spaced values of |
xlab |
label for the x-axis (defaults to the value of |
ylab |
label for the y-axis (defaults to |
main |
main title for the graph (if missing, constructed from the variables and
values in |
cex.main |
size of main title (see |
digits.main |
number of digits to retain when rounding values for the main title. |
font.main |
font for main title (see |
pch |
plotting characters (see |
lwd |
line width (see |
lty |
line types (see |
col |
line colors (see |
legend |
if |
legend.inset |
default |
legend.location |
position of the legend (default |
legend.bty |
the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n". |
conf.level |
the level for pointwise confidence envelopes around the predicted response probabilities;
the default is |
conf.alpha |
the opacity of the confidence envelopes; the default is |
... |
arguments to be passed to |
Value
NULL Used for its side-effect of producing a plot
Author(s)
John Fox jfox@mcmaster.ca
See Also
Examples
data("Womenlf", package = "carData")
m <- nestedLogit(partic ~ hincome + children,
logits(work=dichotomy("not.work", c("parttime", "fulltime")),
full=dichotomy("parttime", "fulltime")),
data=Womenlf)
plot(m, legend.location="top")
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
plot(m, "hincome", list(children="absent"),
xlab="Husband's Income", legend=FALSE)
plot(m, "hincome", list(children="present"),
xlab="Husband's Income")
par(op)