You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/nestedLogit.Rmd
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -459,10 +459,15 @@ various levels of the other predictors, and to compose these into a single figur
459
459
#| fig.cap = "**plot method**: Predicted probabilities and 95 percent pointwise confidence envelopes of not working, working part-time, and working full-time",
460
460
#| fig.show = "hold"
461
461
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
462
-
plot(wlf.nested, "hincome", list(children="absent"), # left panel
463
-
xlab="Husband's Income", legend.location="top")
464
-
plot(wlf.nested, "hincome", list(children="present"), # right panel
465
-
xlab="Husband's Income", legend=FALSE)
462
+
col <- scales::hue_pal()(3) # ggplot discrete colors
463
+
plot(wlf.nested, "hincome", # left panel
464
+
other = list(children="absent"),
465
+
xlab = "Husband's Income",
466
+
legend.location="top", col = col)
467
+
plot(wlf.nested, "hincome", # right panel
468
+
other = list(children="present"),
469
+
xlab = "Husband's Income",
470
+
legend=FALSE, col = col)
466
471
par(op)
467
472
```
468
473
@@ -491,7 +496,8 @@ An alternative style of effect plot shows the fit as a stacked-area graph (in th
491
496
#| fig.height = 4,
492
497
#| fig.cap = "Stacked-area predictor effect plots for the nested-logit model fit to the `Womenlf` data"
493
498
plot(predictorEffects(wlf.nested),
494
-
axes=list(y=list(style="stacked")))
499
+
axes=list(y=list(style="stacked")),
500
+
lines=list(col=scales::hue_pal()(3)))
495
501
```
496
502
497
503
The computation and display of effect graphs are highly customizable. For details, see the documentation for the **effects** package.
@@ -553,10 +559,15 @@ Here's a graph of the alternative model:
553
559
#| fig.cap = "Predicted probabilities for the alternative nested-dichotomies model",
554
560
#| fig.show = "hold"
555
561
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
556
-
plot(wlf.nested.alt, "hincome", list(children="absent"), # left panel
557
-
xlab="Husband's Income", legend.location="top")
558
-
plot(wlf.nested.alt, "hincome", list(children="present"), # right panel
559
-
xlab="Husband's Income", legend=FALSE)
562
+
col <- scales::hue_pal()(3)
563
+
plot(wlf.nested.alt, "hincome", # left panel
564
+
others = list(children="absent"),
565
+
xlab="Husband's Income",
566
+
legend.location="top", col = col)
567
+
plot(wlf.nested.alt, "hincome", # right panel
568
+
others = list(children="present"),
569
+
xlab="Husband's Income",
570
+
legend=FALSE, col = col)
560
571
par(op)
561
572
```
562
573
Compare this to the previous graph for the original specification.
0 commit comments