Effect.nestedLogit {nestedLogit} | R Documentation |
Effect Displays for Nested Logit Models
Description
Computes effects (in the sense of the effects package—see, in
particular, Effect
)—for "nestedLogit"
models, which then
can be used with other functions in the effects package, for example,
predictorEffects
and to produce effect plots.
Usage
## S3 method for class 'nestedLogit'
Effect(
focal.predictors,
mod,
confidence.level = 0.95,
fixed.predictors = NULL,
...
)
Arguments
focal.predictors |
a character vector of the names of one or more of the predictors in the model, for which the effect display should be computed. |
mod |
a |
confidence.level |
for point-wise confidence bands around the effects
(the default is |
fixed.predictors |
controls the values at which other predictors are fixed;
see |
... |
optional arguments to be passed to the |
Value
an object of class "effpoly"
(see Effect
).
Author(s)
John Fox
References
John Fox and Sanford Weisberg (2019). An R Companion to Applied Regression, 3rd Edition. Sage, Thousand Oaks, CA.
John Fox, Sanford Weisberg (2018). Visualizing Fit and Lack of Fit in Complex Regression Models with Predictor Effect Plots and Partial Residuals. Journal of Statistical Software, 87(9), 1-27.
See Also
Effect
, plot.effpoly
,
predictorEffects
Examples
data("Womenlf", package = "carData")
comparisons <- logits(work=dichotomy("not.work",
working=c("parttime", "fulltime")),
full=dichotomy("parttime", "fulltime"))
m <- nestedLogit(partic ~ hincome + children,
dichotomies = comparisons,
data=Womenlf)
peff.women <- effects::predictorEffects(m)
plot(peff.women)
plot(peff.women, axes=list(y=list(style="stacked")))
summary(peff.women)
dichots <- logits(AB_CD = dichotomy(c("A", "B"), c("C", "D")),
A_B = dichotomy("A", "B"),
C_D = dichotomy("C", "D"))
m.health <- nestedLogit(product4 ~ age + gender*household + position_level,
dichotomies = dichots, data = HealthInsurance)
eff.gen.hh <- effects::Effect(c("gender", "household"), m.health,
xlevels=list(household=0:7))
eff.gen.hh
plot(eff.gen.hh, axes=list(x=list(rug=FALSE)))
plot(eff.gen.hh, axes=list(x=list(rug=FALSE),
y=list(style="stacked")))