View source: R/Effect.nestedLogit.R
Effect.nestedLogit | R Documentation |
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.
## S3 method for class 'nestedLogit'
Effect(
focal.predictors,
mod,
confidence.level = 0.95,
fixed.predictors = NULL,
...
)
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 |
an object of class "effpoly"
(see Effect
).
John Fox
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.
Effect
, plot.effpoly
,
predictorEffects
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")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.