plot.predProbs: Plot predicted probabilities

Description Usage Arguments Details Value Author(s) Examples

View source: R/predProbs.r

Description

Plots predicted probabilities and associated confidence bands, using the data returned from a call to predProbs.

Usage

1
2
## S3 method for class 'predProbs'
plot(x, which = NULL, ask = FALSE, ...)

Arguments

x

an object of class predProbs (i.e., a data frame returned by predProbs).

which

optional integer specifying which plot (as numbered in the menu displayed when ask == TRUE) to make. If none is given, all available plots are printed in succession.

ask

logical: display interactive menu with options for which plot to make?

...

further arguments to pass to the plotting function. See plot.default (when the variable on the x-axis is continuous) or bxp (when it is discrete).

Details

Most predProbs objects will be associated with multiple plots: one for each outcome in the estimated model. These are the three or four terminal nodes for a egame12 or egame122 model respectively; for an ultimatum model, these are the expected offer and the probability of acceptance. By default, plot.predProbs produces plots for all of them, so only the last will be visible unless the graphics device is set to have multiple figures (e.g., by setting par(mfrow = ...)). The argument ask displays a menu to select among the possible plots for a given object, and which allows for this to be done non-interactively.

Value

an object of class preplot.predProbs, invisibly. This contains the raw information used by lower-level plotting functions.

Author(s)

Brenton Kenkel (brenton.kenkel@gmail.com)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
data("war1800")
f1 <- esc + war ~ s_wt_re1 + revis1 | 0 | regime1 | balanc + regime2
m1 <- egame12(f1, data = war1800, boot = 10)
pp1 <- predProbs(m1, x = "balanc", n = 5)
pp2 <- predProbs(m1, x = "regime1")

## if "ask" is FALSE and "which" isn't specified, all plots are printed
op <- par(mfrow = c(2, 2))
plot(pp1)
par(op)

## Not run: 
    plot(pp1, ask = TRUE)

    ## Make a plot selection (or 0 to exit):
    ##   1: plot: Pr(~esc)
    ##   2: plot: Pr(esc,~war)
    ##   3: plot: Pr(esc,war)
    ##   4: plot all terms

## End(Not run)

## To change line type for confidence bounds, use argument `lty.ci`
plot(pp1, which = 3, lty.ci = 3)

## All the standard plotting options work too
plot(pp1, which = 3, xlab = "Capabilities", ylab = "Probability", main = "Title")

## Discrete `x` variables are plotted via R's boxplot functionality
plot(pp2, which = 3)

games documentation built on May 2, 2019, 3:26 p.m.