predProbs

0th

Percentile

User-friendly predicted probability analysis

Easy generation and plotting of predicted probabilities from a fitted strategic model.

Usage
predProbs(model, x, xlim = c(min(x), max(x)), n = 100, ci = 0.95, type = c("outcome", "action"), makePlots = FALSE, report = TRUE, ...)
Arguments
model
a fitted model of class game.
x
character string giving the name of the variable to place "on the x-axis" while all others are held constant. Partial matches are accepted.
xlim
numeric, length 2: the range that x should be varied over (if x is continuous). Defaults to the observed range of x.
n
integer: the number of observations to generate (if x is continuous).
ci
numeric: width of the confidence interval to estimate around each predicted probability. Set to 0 to estimate no confidence intervals.
type
whether to generate predicted values for outcomes (the default) or actions
makePlots
logical: whether to automatically make the default plot for the returned object. See plot.predProbs.
report
logical: whether to print a status bar while obtaining the confidence intervals for the predicted probabilities.
...
used to set values for variables other than x in the profile of observations. See "Details" and "Examples".
Details

predProbs provides an easy way to analyze the estimated marginal effect of an independent variable on the probability of particular outcomes, using the estimates returned by a strategic model. The procedure is designed so that, for a preliminary analysis, the user can simply specify the fitted model and the independent variable of interest, and quickly obtain plots of predicted probabilities. However, it is flexible enough to allow for finely tuned analysis as well.

The procedure works by varying x, the variable of interest, across its observed range (or one specified by the user in xlim) while holding all other independent variables in the model fixed. The profile created by default is as follows (the same defaults as in the sim function in the Zelig package):

  • numeric, non-binary variables are fixed at their means
  • ordered variables are fixed at their medians
  • all others are fixed at their modes (see Mode)

However, it is possible to override these defaults for any or all variables. For example, to set a variable named polity to its lower quartile, call predProbs with the argument polity = quantile(polity, 0.25). To set a factor variable to a particular level, provide the name of the level as a character string (in quotes). (Also see the examples below.)

Confidence intervals for each predicted point are generated by bootstrap. If model has a non-null boot.matrix element (i.e., a bootstrap was performed with the model fitting), then these results are used to make the confidence intervals. Otherwise, a parametric bootstrap sample is generated by sampling from a multivariate normal distribution around the parameter estimates. In this case, a warning is issued.

For information on plotting the predicted probabilities, see plot.predProbs. The plots are made with base graphics. If you prefer to use an alternative graphics package, all the information necessary to make the plots is included in the data frame returned.

Value

An object of class predProbs. This is a data frame containing each hypothetical observation's predicted probability, the upper and lower bounds of the confidence interval, and the value of each regressor.

See Also

predict.game for somewhat more flexible (but fussier) generation of predicted probabilities.

Aliases
  • predProbs
Examples
data("war1800")
f1 <- esc + war ~ s_wt_re1 + revis1 | 0 | regime1 | balanc + regime2
m1 <- egame12(f1, data = war1800, boot = 10)

pp1 <- predProbs(m1, x = "s_wt_re1", n = 5)
print(pp1)  ## Hypothetical observations and their predicted probs
plot(pp1, which = 2)  ## See ?plot.predProbs for more plot examples

## Changing the profile used
pp2 <- predProbs(m1, x = "s_wt_re1", n = 5, revis1 = 1, balanc = 0.7)
pp3 <- predProbs(m1, x = "s_wt_re1", n = 5, regime1 = "dem")
pp4 <- predProbs(m1, x = "s_wt_re1", n = 5, balanc = median(balanc))

## Variable names (other than `x`) must match exactly!
## Not run: 
#     pp5 <- predProbs(m1, x = "s_wt_re1", bal = 0.7)  ## Error will result
# ## End(Not run)

## `x` can be a factor too
pp6 <- predProbs(m1, x = "regime1")

## Action probabilities
pp7 <- predProbs(m1, x = "regime1", type = "action")
Documentation reproduced from package games, version 1.1.2, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.