Description Usage Arguments Details Value Author(s) See Also Examples
Easy generation and plotting of predicted probabilities from a fitted strategic model.
1 2 
model 
a fitted model of class 
x 
character string giving the name of the variable to place "on the xaxis" while all others are held constant. Partial matches are accepted. 
xlim 
numeric, length 2: the range that 
n 
integer: the number of observations to generate (if 
ci 
numeric: width of the confidence interval to estimate around each
predicted probability. Set to 
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 
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 
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, nonbinary 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 nonnull 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.
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.
Brenton Kenkel (brenton.kenkel@gmail.com). Code for
escaping special regex characters was taken from the Hmisc
package's
function escapeRegex
, written by Charles Dupont.
predict.game
for somewhat more flexible (but fussier)
generation of predicted probabilities.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  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")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.